Bug Description
I have been experimenting with HTTP_PROXY & NODE_USE_ENV_PROXY and realized that the created ProxyAgent uses proxyTunnel: true by default which may fail if the proxy does not implement CONNECT. As a result, undici loops forever.
Reproducible By
See https://github.com/ArnaudBuchholz/training-fetch-proxy
run the proxy using node reserve-proxy
use npm run native-fetch to reproduce the issue.
use NODE_DEBU=undici npm run native-fetch to see the infinite loop
Expected Behavior
Have a way to disable proxyTunnel
Logs & Screenshots
UNDICI 13766: connecting to www.google.com using http:undefined
UNDICI 13766: connecting to localhost:8989:8989 using http:undefined
UNDICI 13766: connected to localhost:8989:8989 using http:h1
UNDICI 13766: sending request to CONNECT http://localhost:8989www.google.com:80
UNDICI 13766: request to CONNECT http://localhost:8989www.google.com:80 errored - other side closed
UNDICI 13766: connection to www.google.com using http:undefined errored - other side closed
UNDICI 13766: connecting to www.google.com using http:undefined
UNDICI 13766: connecting to localhost:8989:8989 using http:undefined
UNDICI 13766: connected to localhost:8989:8989 using http:h1
UNDICI 13766: sending request to CONNECT http://localhost:8989www.google.com:80
UNDICI 13766: request to CONNECT http://localhost:8989www.google.com:80 errored - other side closed
UNDICI 13766: connection to www.google.com using http:undefined errored - other side closed
UNDICI 13766: connecting to www.google.com using http:undefined
UNDICI 13766: connecting to localhost:8989:8989 using http:undefined
UNDICI 13766: connected to localhost:8989:8989 using http:h1
UNDICI 13766: sending request to CONNECT http://localhost:8989www.google.com:80
UNDICI 13766: request to CONNECT http://localhost:8989www.google.com:80 errored - other side closed
UNDICI 13766: connection to www.google.com using http:undefined errored - other side closed
UNDICI 13766: connecting to www.google.com using http:undefined
UNDICI 13766: connecting to localhost:8989:8989 using http:undefined
UNDICI 13766: connected to localhost:8989:8989 using http:h1
Environment
Mac OS / Tahoe 26.3.1
Node 24.14
Additional context
Bug Description
I have been experimenting with HTTP_PROXY & NODE_USE_ENV_PROXY and realized that the created
ProxyAgentusesproxyTunnel: trueby default which may fail if the proxy does not implement CONNECT. As a result, undici loops forever.Reproducible By
See https://github.com/ArnaudBuchholz/training-fetch-proxy
run the proxy using
node reserve-proxyuse
npm run native-fetchto reproduce the issue.use
NODE_DEBU=undici npm run native-fetchto see the infinite loopExpected Behavior
Have a way to disable
proxyTunnelLogs & Screenshots
Environment
Mac OS / Tahoe 26.3.1
Node 24.14
Additional context