Originally published on proxymint.

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.

TL;DR

  • 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.
  • 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.
  • 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.
  • 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.

Key takeaways

  • Put a kill-the-proxy test in CI. With the proxy down, every client in the lab failed with ECONNREFUSED on all four builds, so a request that still succeeds without the proxy never used it.
  • List 127.0.0.1 and ::1 next to localhost in NO_PROXY. Node's built-in support and undici's EnvHttpProxyAgent did not treat localhost as matching 127.0.0.1, and axios did only when the Node switch was off.
  • Don't mix an axios proxy option with NODE_USE_ENV_PROXY. On http targets the proxy answered 400 on 22.23.4 and 24.14.1, and Node threw ERR_INVALID_ARG_VALUE on 24.22.2 and 26.13.0.
  • Recheck alerts that match fetch error codes. On Node 26 a 407 on an http:// URL surfaces as UND_ERR_INVALID_ARG instead of UND_ERR_ABORTED, because fetch now forwards those requests instead of tunnelling them.
  • Upgrade past 24.14.1 before logging tunnel errors. Its ERR_PROXY_TUNNEL message printed the proxy password. On 22.23.4, 24.22.2 and 26.13.0 the same message left the login out.

Read the full guide on proxymint, with the commands, tables and sources.