Integrations · Automation & scraping
Use HProxy with Axios & Node.js.
Route Axios or node-fetch through an HProxy proxy with a proxy agent.
Axios is the most popular HTTP client for Node and the browser; in Node it needs a proxy agent to route through an upstream proxy.
Server-side Node requests come from a datacenter by default, the first thing a reputation check flags. A residential agent puts an ordinary-looking IP in front of every call.
Setting up HProxy in Axios & Node.js
- 1.Install https-proxy-agent (npm i https-proxy-agent).
- 2.Build an agent from your proxy URL, login included.
- 3.Pass the agent to Axios (httpsAgent) or to node-fetch (agent).
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://user-country-us:pass@res.hproxy.com:8080");
const { data } = await axios.get("https://ipinfo.io/json", { httpsAgent: agent });
console.log(data);The host, port and login shown here are the format; your exact values are on your dashboard, ready to copy.