Use ProxyHQ with Node.js (node-fetch)
Use ProxyHQ with node-fetch.
Connection details
Use these values. Your login and password are in your dashboard.
| Type | HTTP (or SOCKS5) |
| Host | gw.proxyhq.net |
| Port (HTTP / HTTPS) | 823 |
| Port (SOCKS5) | 824 |
| Sticky ports | 10000 - 20000 |
| Username | YOUR_LOGIN |
| Password | YOUR_PASSWORD |
Steps
- Install the packages: npm install node-fetch https-proxy-agent.
- Create a proxy agent from your proxy URL and pass it as the agent option.
import fetch from "node-fetch";
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent(
"http://YOUR_LOGIN__cr.us:[email protected]:823"
);
const res = await fetch("https://api.ipify.org", { agent });
console.log(await res.text());Choose a country or a sticky IP
Add __cr.de (or another country code) to the end of your login to choose a country. Use a port from 10000 to 20000 for a sticky IP. See country targeting and rotating vs sticky.
Stuck? See troubleshooting or email [email protected].