Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsIn Axios v1.x, route a request through an HTTP proxy by setting proxy to an object containing the proxy protocol, host, and port. Add auth only when the proxy requires HTTP Basic authentication. For repeated requests, put the same object on an Axios instance. Use proxy: false to bypass Axios proxy resolution for one request. Environment variables and Node’s newer native proxy support are useful, but their behavior depends on your Node version, agent, and startup flags.
Explicit proxy configuration in Axios
The most predictable setup is an explicit Axios configuration. The following example targets Axios v1.x and a current supported Node.js release. Replace the placeholder host, port, and destination with values authorized for your deployment.
const axios = require('axios');
async function main() {
const client = axios.create({
proxy: {
protocol: 'http',
host: 'proxy.example.com',
port: 8080
}
});
const response = await client.get('https://api.example.com/data');
console.log(response.status, response.data);
}
main().catch((error) => {
console.error(error.code || error.message);
process.exitCode = 1;
});
The protocol value describes the proxy connection (for example, http), not whether the destination URL is HTTP or HTTPS. Axios uses CONNECT tunneling when the destination is HTTPS, carrying TLS to the origin through the tunnel. Keep normal certificate verification enabled.
Proxy authentication
If the proxy challenges for HTTP Basic authentication, add credentials under auth. Read them from the environment rather than committing them to source control.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
const axios = require('axios');
const client = axios.create({
proxy: {
protocol: 'http',
host: process.env.PROXY_HOST,
port: Number(process.env.PROXY_PORT || 8080),
auth: {
username: process.env.PROXY_USER,
password: process.env.PROXY_PASSWORD
}
}
});
client.get('https://api.example.com/data')
.then((response) => console.log(response.data))
.catch((error) => console.error(error.message));
Only send auth when the proxy actually requires it. Proxy credentials authenticate the proxy connection; they are not credentials for the destination API.
One proxy for many requests
An Axios instance gives a shared scope without changing every request or every process in which your program runs.
const axios = require('axios');
const throughProxy = axios.create({
timeout: 30000,
proxy: {
protocol: 'http',
host: process.env.PROXY_HOST || 'proxy.example.com',
port: Number(process.env.PROXY_PORT || 8080)
}
});
async function loadData() {
const [users, invoices] = await Promise.all([
throughProxy.get('https://api.example.com/users'),
throughProxy.get('https://api.example.com/invoices')
]);
return { users: users.data, invoices: invoices.data };
}
loadData().then(console.log).catch(console.error);
Axios merges library defaults, instance defaults, and request configuration in that order. A request-level value therefore overrides the instance value.
const response = await throughProxy.get('https://status.example.com', {
proxy: {
protocol: 'http',
host: 'backup-proxy.example.com',
port: 8080
}
});
Using HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
Axios documents the conventional lowercase http_proxy, https_proxy, and no_proxy variables. In a shell, for example:
HTTP_PROXY=http://proxy.example.com:8080
HTTPS_PROXY=http://proxy.example.com:8080
NO_PROXY=localhost,127.0.0.1,.internal.example
node app.js
Use the uppercase names when your deployment standard requires them, but do not assume that setting a variable alone gives identical behavior across Node versions, Axios adapters, and custom agents. Axios’s request configuration documentation explains its environment-proxy handling, while current Node HTTP documentation describes native support for HTTP_PROXY, HTTPS_PROXY, and NO_PROXY when that feature is enabled.
Rank #2
Node’s native environment proxy support
Node documents native environment proxy support as added in Node v24.5.0 and v22.21.0. Enable it with NODE_USE_ENV_PROXY=1 or the --use-env-proxy command-line option:
NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://proxy.example.com:8080 node app.js
A custom agent can receive a proxyEnv option. Axios may delegate environment handling to Node when the selected agent has proxyEnv enabled; custom agents without that option continue to use Axios’s environment resolution. Explicit Axios proxy configuration remains handled by Axios.
Because these paths have different owners, choose one deliberately. Record the deployed Node and Axios versions, the adapter or custom agent, and the process flags when diagnosing an environment variable that appears to be ignored.
Recommended Free Tools
How NO_PROXY matching works
Node’s documented NO_PROXY format accepts comma-separated exact host names, domain suffix or wildcard forms, IP addresses, ranges, optional ports, and * to bypass every host. Check the actual destination hostname and port. A bypass entry that matches api.example.com may not match a different hostname, and an optional port can make an otherwise familiar entry fail to match.
Bypassing a proxy for one Axios request
Set proxy: false when a particular request must not use Axios proxy resolution. This also ignores proxy environment variables for that request.
Rank #3
const axios = require('axios');
const direct = await axios.get('https://internal.example.com/health', {
proxy: false,
timeout: 10000
});
console.log(direct.status);
Use this for a known direct route, such as an internal service reachable from the application network. It does not override a custom agent that owns the transport.
Custom agents and competing proxy mechanisms
An httpAgent or httpsAgent can manage connection pooling, TLS, and proxying. Its behavior comes from the agent’s own configuration. Do not configure an agent-managed proxy and an Axios proxy object without knowing which layer is expected to open the connection.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →When an agent owns proxying, set proxy: false so Axios does not try to apply a second proxy mechanism:
const axios = require('axios');
// agent is configured by your transport library to perform proxying
const agent = createYourConfiguredAgent();
const response = await axios.get('https://api.example.com/data', {
httpAgent: agent,
httpsAgent: agent,
proxy: false
});
createYourConfiguredAgent is intentionally a placeholder: the correct agent depends on your approved transport library and proxy type. The important rule is ownership—Axios’s proxy object does not configure an unrelated agent.
HTTPS destinations, TLS, and security
For an HTTPS URL, Axios can establish a CONNECT tunnel through an HTTP proxy and then perform TLS with the origin. Preserve certificate verification. If your organization uses a private certificate authority, configure the appropriate trusted CA in the agent or runtime; do not “fix” a proxy error by disabling TLS verification.
Rank #4
A proxy is a routing component, not an anonymity guarantee. Node’s HTTP documentation cautions: “It is not an anonymity or traffic-hiding feature and does not attempt to hide traffic from the proxy, the local network, network operators, or authorities that govern the deployment.” The proxy can observe connection metadata, and plain HTTP content—or traffic whose TLS is terminated or intercepted—may be visible to it. Use only an endpoint authorized for your application and data.
Free tools Windows power users keep installed
One-click scans. No signup required.
Choosing a configuration path
| Situation | Recommended path | What owns the decision |
|---|---|---|
| One request needs a known proxy | Request-level proxy object |
Axios |
| Several requests in one client share a proxy | Axios instance defaults | Axios |
| Operations controls routing outside application code | Environment variables, after verifying runtime and agent behavior | Axios or Node, depending on the selected agent and Node feature |
| A transport library already performs proxying | Configured custom agent plus proxy: false |
The custom agent |
| One request must avoid all Axios proxy resolution | proxy: false |
Direct Axios request; an agent may still control transport |
Troubleshooting common failures
“Proxy” appears ignored
- Log the Node.js and Axios versions and inspect whether a custom agent or adapter is selected.
- Check that
protocol,host, and numericportare present in the explicit object. - If using environment variables, verify the process inherited them and that
NO_PROXYdoes not match the destination. - On Node’s native path, confirm Node v24.5.0 or newer, or v22.21.0 or newer, and start with
NODE_USE_ENV_PROXY=1or--use-env-proxy.
Authentication errors from the proxy
A 407 response normally means the proxy expects authentication. Confirm the username and password with the proxy operator, then provide them under Axios’s proxy auth object. Do not put destination API credentials in that object.
Connection refused or timeout
- Check DNS and network reachability for the proxy host from the machine running Node.
- Confirm the port and whether the endpoint accepts HTTP CONNECT for HTTPS destinations.
- Use a finite Axios timeout and inspect the error code. A timeout can indicate an unreachable proxy, a blocked destination, or a slow origin.
- Ensure a firewall or egress policy permits the route.
TLS certificate errors
Verify the origin certificate chain and the proxy’s interception policy. Install the deployment’s trusted CA through the supported agent or runtime configuration. Keep certificate verification enabled; changing rejectUnauthorized to false removes an important security control.
Unexpected direct or proxied requests
Review exact host, suffix, wildcard, IP, and port matching in NO_PROXY. Then check whether proxy: false is set on the request and whether a custom agent has its own proxy rules.
Operational and cost considerations
Proxying adds a network hop, so measure latency from the actual deployment region rather than assuming a fixed overhead. Reuse an Axios instance and its agent where appropriate to avoid needless connection setup. Set explicit timeouts, classify retryable network failures carefully, and avoid retrying non-idempotent operations without an application-level idempotency strategy.
Keep proxy URLs and credentials outside logs. Redact authorization headers and environment values in diagnostics. If the proxy is shared, monitor its connection limits and coordinate rate limits with the destination service. No general performance or adoption statistic is established for Axios proxies; results depend on the proxy, route, destination, and workload.
Or skip the browser setup:
If your goal is to obtain clean website screenshots rather than route an Axios API request, ScreenshotNeo is a separate website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF output. It accepts cookie or consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.
Use the API documentation at https://screenshotneo.com/docs/ for the full option list. A minimal call is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same endpoint can be called from Node.js or Python:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = require('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
ScreenshotNeo also provides an MCP server for AI agents, including Claude and Cursor, with take_screenshot, get_page_info, and capture_pdf tools. Its 63 options include full-page lazy-image loading, CSS-selector element capture, dark mode, device presets, custom viewport and retina scale, PDF paper and page controls, custom CSS and JavaScript, click and wait actions, ad or tracker blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Familiar parameter names from other screenshot APIs also work.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account.
Frequently Asked Questions
How do I set an HTTP proxy in Axios?
Pass Axios a proxy object with protocol, host, and port; add auth only for proxy Basic authentication.
How do I use HTTPS_PROXY with Axios in Node.js?
Set the variable in the process environment, then verify the Node.js version, startup flag, selected agent, and NO_PROXY matches. For Node’s native support, use Node v24.5.0+ or v22.21.0+ with NODE_USE_ENV_PROXY=1 or --use-env-proxy.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →How do I bypass a proxy for one Axios request?
Set proxy: false on that request. A custom agent may still apply its own transport or proxy rules.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

