Node.js + Axios Proxy Setup (HTTP + SOCKS)
Use Proxiesseller proxies in Node.js Axios with agents and safe defaults.
Published January 03, 2026 • 5 min read
Overview
Axios needs proper agent configuration for proxies. This guide shows stable patterns for HTTP proxies.
Installation & Setup
Install Axios:
npm i axiosExamples
import axios from "axios";
const client = axios.create({
proxy: {
protocol: "http",
host: "HOST",
port: Number("PORT"),
auth: { username: "USER", password: "PASS" },
},
timeout: 15000,
});
const r = await client.get("https://api.ipify.org");
console.log(r.data);Troubleshooting
- If proxy is ignored: ensure you didn't set HTTP(S)_PROXY env vars conflicting
- If TLS errors: use https endpoint and correct proxy protocol
- If blocked: rotate IPs and reduce request bursts