Use ProxyHQ with Axios
Use ProxyHQ with Axios.
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 axios https-proxy-agent.
- Use a proxy agent and turn off Axios' own proxy option. This works reliably for both http and https sites.
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent(
"http://YOUR_LOGIN__cr.us:[email protected]:823"
);
const res = await axios.get("https://api.ipify.org", {
httpsAgent: agent,
httpAgent: agent,
proxy: false,
timeout: 30000,
});
console.log(res.data);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].