Node 26 proxy: which clients use HTTP_PROXY, tested

Node 26 LTS tested next to 22 and 24: which of fetch, http, undici and axios use HTTP_PROXY, NO_PROXY, a 407 or socks5://, and which go direct.

Robot at an observation missing screen, checking which route Node 26 used for its proxy
Quick summary · TL;DR
  1. Node 26 fetch still ignores HTTP_PROXY until you turn the switch on. Start the process with NODE_USE_ENV_PROXY=1, --use-env-proxy or NODE_OPTIONS=--use-env-proxy. Without one of them, fetch and http.get go straight to the target and return a normal 200, so nothing looks wrong.
  2. Set HTTPS_PROXY too, not just HTTP_PROXY. With only HTTP_PROXY set, fetch tunnelled https URLs through the proxy while the https module and axios 1.21.0 went direct. That held on 22, 24 and 26 alike, so one process can split its traffic without a single warning.
  3. Keep SOCKS URLs out of the environment. socks5h:// in HTTP_PROXY crashed Node at startup on every version tested once the switch was on, and on 24 and 26 socks5:// sent fetch through SOCKS5 while http and axios quietly skipped the proxy.
  4. Upgrading fixes the npm undici 8 mismatch. A ProxyAgent from npm undici 8.12.4 inside built-in fetch failed with invalid onRequestStart method on Node 22 and 24 and worked on 26.13.0, which bundles undici 8.12.2.

A node 26 proxy set through HTTP_PROXY and HTTPS_PROXY still does nothing for built-in fetch and http.get unless the process starts with NODE_USE_ENV_PROXY=1 or --use-env-proxy. Without either, both connect straight to the target and print a normal 200 while the proxy log stays empty. That’s the most common surprise after an upgrade, and Node 26 didn’t change it.

The rest depends on the client.

  • axios and undici’s EnvHttpProxyAgent read the variables on their own.
  • The http module ignores HTTP_PROXY for an https URL.
  • A socks5:// value can route one client through SOCKS5 while another goes direct in the same process.

Everything below ran on 5 November 2026 (UTC) on macOS 26.6.2 (arm64), with official nodejs.org binaries checked against their SHASUMS256 files: Node 22.23.4, 24.14.1, 24.22.2 and 26.13.0. The clients were the built-in fetch, the http and https modules, the undici package 8.12.4 and axios 1.21.0. There was no real proxy. The test used local test proxies on 127.0.0.1 that log every request:

  • an open HTTP proxy that handles both forwarding and CONNECT
  • the same proxy with a Basic login (canary credentials)
  • a SOCKS5 server
  • HTTP and HTTPS targets, also on 127.0.0.1

A request “went direct” when the target logged a hit and no proxy logged anything. The matrix was 24 environment cases times 8 client setups times 4 Node builds, 768 runs, and a second full pass gave the same route and outcome in every one. Windows and Linux weren’t tested.

Node 26 proxy: what changed

Less than you’d hope. Node 26 became LTS with 26.13.0 “Lithium” on 28 October 2026, and the 26.13.0 changelog says that release changed nothing apart from LTS metadata. The Node release schedule (checked 5 November 2026) gives Node 26 active LTS until 20 October 2027 and security fixes until 30 April 2029. Node 24 “Krypton” moved to maintenance on 20 October 2026 and ends on 30 April 2028. Node 22 “Jod” ends on 30 April 2027.

Most of the differences between Node lines come from the undici each one bundles, not from the proxy feature itself. Node 26 shipped undici 8 in 26.0.0, according to the same changelog, and that’s the reason the npm undici 8 row flips.

NODE_USE_ENV_PROXY and —use-env-proxy

The switch. Node’s CLI docs for 26.13.0 say NODE_USE_ENV_PROXY=1 makes Node parse HTTP_PROXY, HTTPS_PROXY and NO_PROXY at startup and route requests through the proxy. The variable was added in v24.0.0 and v22.21.0. The --use-env-proxy flag arrived in v24.5.0 and v22.21.0, and it wins when both are set. Both are still marked Stability 1.1, Active Development, so behaviour can still move between minor releases.

What it covers. Per the http docs, the switch builds the global HTTP agent with proxyEnv: process.env, and it covers fetch as well. Support for http and https landed in v24.5.0 and v22.21.0. http.setGlobalProxyFromEnv(), which turns it on from code, is newer: v25.4.0 and v24.14.0.

In the lab all three ways of turning it on behaved the same on every version:

NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT node app.js
HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT node --use-env-proxy app.js
NODE_OPTIONS=--use-env-proxy HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT node app.js

The NODE_OPTIONS form is the useful one for containers and CI, where you control the environment but not the start command. Node 22.23.4 also printed [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental on stderr whenever the switch was on, and Node 24 and 26 printed nothing.

One more thing changed under the hood. With the switch on, Node 22 and 24 sent a plain http:// request from fetch through a CONNECT tunnel, and Node 26 sent it as an ordinary forwarded GET http://.... The http module forwarded on all three. Most proxies accept both, but a proxy or firewall rule that only allows CONNECT to port 443 will see Node 26 fetch traffic differently after the upgrade.

Which Node clients read HTTP_PROXY

Each row is an http:// target with HTTP_PROXY pointing at the logging proxy and nothing else set. The results were identical on 22.23.4, 24.14.1, 24.22.2 and 26.13.0 unless the cell says otherwise.

ClientSwitch offNODE_USE_ENV_PROXY=1 or —use-env-proxy
Built-in fetch(url)Direct, 200Proxy
http.get(url) (global agent)Direct, 200Proxy
new http.Agent({ proxyEnv: process.env })ProxyProxy
undici fetch + EnvHttpProxyAgentProxyProxy
undici fetch + ProxyAgent(url)ProxyProxy
Built-in fetch + npm undici 8 ProxyAgentFails on 22 and 24, proxy on 26Same
axios, no proxy optionProxyProxy
axios with an explicit proxy optionProxyBroken (see below)

The two rows that go direct are the ones people expect to work. Nothing warns you, which is why “the proxy did nothing after the upgrade” tickets are so slow to close. The proxyEnv agent option is the quiet fix for library code: it reads the variables without any process-wide switch, on Node 24.5+ and 22.21+.

axios 1.21.0 has its own environment handling, but its source checks whether Node’s built-in proxy support is active on the agent, and the lab matches that. With the switch on, axios followed Node’s rules, and with it off, its own. That’s why NO_PROXY=localhost behaved differently for axios depending on the switch, as the NO_PROXY section shows.

The npm undici row is the classic version trap. Passing a ProxyAgent from npm undici 8.12.4 into the built-in fetch failed on Node 22 and 24 with TypeError: fetch failed, caused by invalid onRequestStart method, and never reached the proxy. On Node 26, whose bundled undici is also 8.x, it worked. Upgrading to 26 fixes it, and so does importing fetch from the same package as the agent.

The other way round works on every version. The snippet many fetch proxy answers give, registering the agent globally, sent built-in fetch through the proxy on 22.23.4, 24.14.1, 24.22.2 and 26.13.0 with npm undici 8.12.4 and no Node switch:

import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici';

setGlobalDispatcher(new EnvHttpProxyAgent());
const res = await fetch('https://example.com/');

It honoured NO_PROXY port entries and used HTTP_PROXY for https URLs when HTTPS_PROXY was missing. It only covers fetch, though. http.get in the same process still went direct.

HTTPS targets through CONNECT

Set HTTPS_PROXY for https URLs and every client tunnels with CONNECT, as long as it’s reading the environment at all. With the switch off, built-in fetch and https.get went direct here too.

The surprise was the case where only HTTP_PROXY is set and the target is https:

Client (switch on, only HTTP_PROXY set, https target)Result on all four versions
Built-in fetchProxy, CONNECT
undici EnvHttpProxyAgentProxy, CONNECT
https.get and https.Agent({ proxyEnv })Direct, 200
axiosDirect, 200

The undici-based clients fall back to HTTP_PROXY for https URLs, and https and axios don’t. So one process can split its traffic, with fetch calls going through the proxy and an SDK built on https going around it. Set both variables to the same http:// proxy URL and the split goes away:

export HTTP_PROXY=http://USERNAME:PASSWORD@HOST:PORT
export HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT
export NODE_USE_ENV_PROXY=1

The scheme stays http:// for https sites. The client sends CONNECT and the TLS session runs inside the tunnel, end to end with the target. Every https run here trusted the local target’s certificate through NODE_EXTRA_CA_CERTS, which is also the variable Node’s enterprise network guide gives for trusting a company CA bundle.

One Node 26 change bites only if you call HTTPS services by IP address. Setting the TLS server name to an IP is end-of-life since v25.0.0 (DEP0123). When axios ran the proxy itself (switch off, or an explicit proxy option), its tunnel to https://127.0.0.1 printed a DeprecationWarning and worked on 22 and 24. On 26.13.0 it failed with ERR_INVALID_ARG_VALUE, “Setting the TLS ServerName to an IP address is not permitted”. With the switch on and no proxy option, axios handed the request to Node and it worked on 26 too. The same error hit fetch over SOCKS5 to an IP target on 26. Every target in this lab was an IP literal, so hostname targets weren’t tested and probably don’t trigger it.

NO_PROXY matching in practice

Port-specific entries worked everywhere. With NO_PROXY=127.0.0.1:19180, every environment-reading client went direct to port 19180 and through the proxy to port 19181, on all four versions. An explicit ProxyAgent ignores NO_PROXY, which is expected, since you gave it a proxy by hand.

localhost is where the clients disagree. With NO_PROXY=localhost and a target at http://127.0.0.1:

  • Node’s built-in support (fetch, http, proxyEnv agents) and undici EnvHttpProxyAgent still used the proxy. A hostname entry doesn’t match an IP.
  • axios with the switch off went direct. Its own matcher treats loopback names and addresses as the same thing.
  • axios with the switch on used the proxy, because it defers to Node.

If you rely on NO_PROXY to keep health checks or a sidecar on loopback, list 127.0.0.1 and ::1 next to localhost. Node’s docs list *, exact hosts, .example.com suffixes, *.example.com, IPs, IP ranges and host:port. The 26.1.0 changelog also records a fix for leading-dot suffix matching, which this lab didn’t test, since it needs hostnames.

Proxy authentication: 407 and URL logins

Credentials in the URL worked on every version and every client that read them. The proxy logged a valid Basic Proxy-Authorization header and returned 200, for http targets (forwarded) and https targets (on the CONNECT). If the password holds characters like @, : or /, encode them first. The proxy string formats guide covers which characters break which tools.

Without credentials, every client got the 407, but each one reports it in its own way, and that matters when you grep logs. These runs had the switch on:

Clienthttp:// targethttps:// target
http.get / https.getResponse with statusCode 407ERR_PROXY_TUNNEL: “Failed to establish tunnel to 127.0.0.1:19443 via http://127.0.0.1:19081: HTTP/1.1 407 Proxy Authentication Required”
Built-in fetch, Node 22 and 24UND_ERR_ABORTED: “Proxy response (407) !== 200 when HTTP Tunneling”Same
Built-in fetch, Node 26UND_ERR_INVALID_ARG: “Proxy Authentication Required (407)”“Proxy response (407) !== 200 when HTTP Tunneling”
axiosResponse with status 407ERR_PROXY_TUNNEL, same text as https.get

Both fetch errors arrive wrapped in TypeError: fetch failed, so the 407 is one or two cause levels down. Note the Node 26 change for http:// targets: since 26 forwards instead of tunnelling, the error code moved from UND_ERR_ABORTED to UND_ERR_INVALID_ARG. An alert that matches on the old code goes quiet after the upgrade. The 407 Proxy Authentication Required guide walks through the causes on the proxy side.

SOCKS5 URLs in HTTP_PROXY

This is where an earlier lab saw a startup crash on Node 24.14.1 with UND_ERR_INVALID_ARG, so every SOCKS variant got a recheck. With --use-env-proxy and a script that only runs console.log, no request at all:

HTTP_PROXY value22.23.424.14.124.22.226.13.0
socks5://127.0.0.1:PORTCrashStartsStartsStarts
socks5h://127.0.0.1:PORTCrashCrashCrashCrash
socks://127.0.0.1:PORTCrashStartsStartsStarts

Every crash is the same error, code UND_ERR_INVALID_ARG, thrown from setupHttpProxy before your code runs:

InvalidArgumentError: Invalid URL protocol: the URL must start with `http:` or `https:`.

So the 24.14.1 crash reproduces with socks5h://, and socks5:// starts fine there. On Node 22, any SOCKS scheme kills the process.

Starting is not the same as working. On 24.14.1, 24.22.2 and 26.13.0 with HTTP_PROXY=socks5://... and the switch on:

  • fetch and undici’s agents went through the SOCKS5 server, which logged the greeting and a CONNECT, and printed ExperimentalWarning: SOCKS5 proxy support is experimental and subject to change.
  • http.get, proxyEnv agents and axios went direct with a 200 and no warning at all.

That’s the nastiest silent direct case in a Node 26 proxy setup. Half the process uses SOCKS5 and half uses no proxy, and nothing on stderr says so. Without the switch, axios rejected the socks5 URL with ERR_ASSERTION, “protocol mismatch”, which is at least loud.

If a library needs SOCKS5, configure it in that library rather than through the environment. For environment-driven setups, an http:// proxy URL is the one value every client in this matrix handled the same way. The SOCKS5 vs HTTP proxy comparison covers what you give up.

Catching silent direct connections

Every silent case above returned a normal response. The ways to prove the route are boring, and they work:

  1. Watch the proxy side. Point the app at a local logging proxy, or read your proxy’s request log, and confirm one line per request. That’s how every cell here was judged.
  2. Kill the proxy and retry. With the proxy down, every client in the lab failed with ECONNREFUSED, on all four versions, and none fell back to direct. A request that still succeeds with the proxy off never used it.
  3. Check the exit IP. Fetch an IP echo endpoint you control through each client in turn. Different clients reporting different IPs is the split-traffic bug.
  4. Print the runtime. node -p "process.version + ' ' + process.versions.undici" tells you which undici rules apply before you copy any ProxyAgent snippet.

The second check is the one to put in CI. It costs a few lines and catches every row marked “direct” in this post.

Node 26 proxy upgrade checklist

If your service starts with NODE_USE_ENV_PROXY=1, a Node 26 proxy setup needs nothing new. Started that way with an http:// proxy in both variables, Node 26 behaved exactly like 22 and 24 in this lab for fetch, http and axios. Upgrade, then rerun the kill-the-proxy check. If any of these apply, deal with them first:

  • No switch set. Built-in fetch and http go direct on 26 too. Add the variable, the flag or NODE_OPTIONS=--use-env-proxy, give library code an agent with proxyEnv, or call setGlobalDispatcher(new EnvHttpProxyAgent()) if only fetch needs it.
  • Only HTTP_PROXY set. https and axios go direct for https URLs. Set HTTPS_PROXY as well.
  • axios with an explicit proxy option. Don’t turn the Node switch on in the same process.
  • A SOCKS URL in the environment. socks5h:// crashes Node at startup with the switch on, and socks5:// routes only undici-based clients. Use http:// in the environment.
  • Alerts on fetch error codes. The http:// 407 code changed from UND_ERR_ABORTED to UND_ERR_INVALID_ARG on 26.
  • HTTPS by IP address through axios’s own proxy handling. It throws on 26. Use a hostname, or let the Node switch carry axios traffic.
  • Coming from Node 22. Its EOL is 30 April 2027, and npm undici 8 needs Node 22.19.0 or later according to its engines field.

If the proxy is proxymint’s, the same rule holds. Every tier takes HTTP and SOCKS5 with a username and password, and for environment-driven Node apps the http://USERNAME:PASSWORD@HOST:PORT form is the one that behaved consistently across every client here. For per-request or timed IP rotation behind that one URL, see rotating residential proxies. The ERR_TUNNEL_CONNECTION_FAILED guide helps when the tunnel itself fails.

Frequently asked questions

Only when the process starts with NODE_USE_ENV_PROXY=1, the --use-env-proxy flag, or that flag in NODE_OPTIONS. Leave all three out and built-in fetch on Node 26.13.0 connected straight to the target with a normal response, exactly like Node 22 and 24. axios and undici's EnvHttpProxyAgent read the variables themselves, so they used the proxy either way.

It makes Node read HTTP_PROXY, HTTPS_PROXY and NO_PROXY at startup and route the global HTTP agent and fetch through that proxy. Node added the variable in 24.0.0 and 22.21.0 and the --use-env-proxy flag in 24.5.0 and 22.21.0, and the flag wins when both are set. Both are still marked Active Development in the Node 26 docs.

Node 26 entered long-term support with version 26.13.0, codename Lithium, on 28 October 2026. The Node release schedule lists maintenance from 20 October 2027 and end of life on 30 April 2029. For comparison, Node 24 ends on 30 April 2028 and Node 22 on 30 April 2027.

Yes. axios 1.21.0 read HTTP_PROXY and HTTPS_PROXY without any Node switch on all versions tested, though it ignored HTTP_PROXY for https URLs. Turning NODE_USE_ENV_PROXY on makes it defer to Node's own proxy handling instead of its own. There is one Node 26 catch. When axios handled the proxy itself (switch off, or an explicit proxy option), HTTPS targets addressed by IP failed with ERR_INVALID_ARG_VALUE about the TLS server name.

Not safely. With the switch on, socks5h:// crashed Node 22, 24 and 26 at startup with UND_ERR_INVALID_ARG, and Node 22.23.4 crashed on socks5:// as well. On 24 and 26, socks5:// made fetch use SOCKS5 while the http module and axios went direct. Configure SOCKS5 inside the library that needs it instead.

Stop the proxy and run the request again. Every client in the lab failed with ECONNREFUSED once the proxy was down, so a request that still succeeds is going direct. To confirm the route, look for one line per request in the proxy access log, or run an IP echo check through each client.

Yes, for exact hosts, IPs and host:port entries. NO_PROXY=127.0.0.1:19180 sent that port direct and every other port through the proxy on all versions tested. A localhost entry did not match requests to 127.0.0.1 in Node's built-in support, so list the addresses as well.

Researched and drafted with AI tools, then checked against our publishing rules before it went live: 7 outside links, 5 links to other proxymint pages, no prices and a fact-check pass against our product records. How we write.