Copy-paste recipes for routing Node.js HTTP clients through an authenticated residential proxy: axios, native fetch (undici), and got.
import axios from "axios"; import { HttpsProxyAgent } from "https-proxy-agent"; const USER = process.env.QP_USER; const PASS = process.env.QP_PASS; const agent = new HttpsProxyAgent( `http://${USER}-country-us:${PASS}@residentialboson.quantumproxies.io:9000` ); const { data } = await axios.get("https://ipinfo.io/json", { httpsAgent: agent, proxy: false, // important: let the agent handle it }); console.log(data);
Gotcha: with axios you must set
proxy: falsewhen using an agent, otherwise axios' own proxy handling conflicts with it.
import { ProxyAgent } from "undici"; const dispatcher = new ProxyAgent( `http://${USER}:${PASS}@residentialboson.quantumproxies.io:9000` ); const res = await fetch("https://ipinfo.io/json", { dispatcher }); console.log(await res.json());
import got from "got"; import { HttpsProxyAgent } from "https-proxy-agent"; const body = await got("https://ipinfo.io/json", { agent: { https: new HttpsProxyAgent(proxyUrl) }, }).json();
The gateway takes routing flags in the username — no API calls needed:
| Flag | Effect |
|---|---|
-country-us |
US exit IP |
-country-us-state-texas-city-houston |
city-level exit |
-session-k3px-lifetime-30 |
keep the same IP for 30 min (use port 10000) |
Run it:
npm install axios https-proxy-agent undici
QP_USER=... QP_PASS=... node axios-proxy.js
Examples use QuantumProxies residential proxies (rotating port 9000, sticky 10000, SOCKS5 12000). Pay-per-GB, 195+ countries — get a username/password pair at app.quantumproxies.io.