Node.js with a UK home IP

Node's built-in fetch doesn't read proxy settings by itself. Pass a proxy dispatcher from undici, or use a SOCKS agent.

Before you start

You need a ProxyPi login. The free 100 MB trial is enough to test this guide. Copy HOST, PORT, USERNAME and PASSWORD from your dashboard. Examples that read PROXYPI_HTTP expect http://USERNAME:PASSWORD@HOST:PORT in that environment variable.

HTTP port with undici

JavaScript (ESM)
// npm install undici
import { fetch, ProxyAgent } from "undici";

const dispatcher = new ProxyAgent(process.env.PROXYPI_HTTP); // http://USERNAME:PASSWORD@HOST:PORT
const res = await fetch("https://api.ipify.org?format=json", { dispatcher });
console.log(await res.json());

SOCKS5 port with socks-proxy-agent

JavaScript (ESM)
// npm install socks-proxy-agent
import https from "node:https";
import { SocksProxyAgent } from "socks-proxy-agent";

const agent = new SocksProxyAgent(process.env.PROXYPI_SOCKS); // socks5h://USERNAME:PASSWORD@HOST:PORT
https.get("https://api.ipify.org", { agent }, (res) => res.pipe(process.stdout));

Good to know

  • axios, got and node-fetch accept the same SocksProxyAgent or an HTTP proxy agent.

Official documentation

Third-party APIs change. We checked these against the official docs on 23 November 2026. If something has moved, the linked docs win.

Try it on a real UK home line

The trial is 100 MB of UK residential data. No card needed. Your host, port and login are in your dashboard once you have signed up.

Use ProxyPi within the acceptable use policy and the terms of the sites and tools you use.