| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Should proxyTunnel be set to true on line 76 in test/env-http-proxy-agent-nodejs-bundle.js? - setGlobalDispatcher(new EnvHttpProxyAgent())
+ setGlobalDispatcher(new EnvHttpProxyAgent({ proxyTunnel: true })) |
Sorry, something went wrong.
|
Thanks for submitting this! Do we have a sense of when this might make it into to a published branch? The reason I ask is that we're trying to replace request with fetch, but our outbound proxy rejects CONNECT requests for https so this is a blocker... trying to decide whether to revert all of it and go back to request we're in a deployable state, or if it's reasonable to wait for this change. |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #5116 +/- ##
==========================================
- Coverage 93.46% 93.46% -0.01%
==========================================
Files 110 110
Lines 37124 37150 +26
==========================================
+ Hits 34698 34722 +24
- Misses 2426 2428 +2 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
|
I investigated the remaining CI failures after the rebase. All regular undici jobs are passing. The only failures left are the --shared-builtin-undici/undici-path jobs for Node 24 and 26. What is happening there:
I checked ../node locally and Node's http.request() tests already expect the curl-style non-tunneled behavior for the same setup:
That last file is especially telling because it currently expects:
So the failing shared-builtin jobs are not showing an undici regression in the main test matrix; they are showing that Node's fetch-side proxy tests need to be updated to match the new behavior. I think the follow-up should be a nodejs/node patch adjusting those test/client-proxy fetch expectations for plain HTTP over HTTP proxy connections. |
Sorry, something went wrong.
| } | ||
|
|
||
| function shouldProxyTunnel (proxyProtocol, requestProtocol, proxyTunnel) { | ||
| return proxyTunnel === true || proxyProtocol !== 'http:' || requestProtocol !== 'http:' |
There was a problem hiding this comment.
I think the rules mostly depend on request protocol, not the proxy protocol? In the case of "http request over https proxy", 9112 3.2.2 says
When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client MUST send the target URI in "absolute-form" as the request-target.
(Basically the same as 7230 5.3.2) so e.g. a GET HTTP request over HTTPS proxy should be sent as
And according to 9110 9.3.6
Tunnels are commonly used to create an end-to-end virtual connection, through one or more proxies, which can then be secured using TLS (Transport Layer Security)
A HTTPS request over HTTP proxy should be sent as
This is also what the builtin https/http.request implements.
(Note: I don't think socks5 count as a proxy defined in https://datatracker.ietf.org/doc/html/rfc9110, and socks5 is always effectively tunneled because the stuff in https://datatracker.ietf.org/doc/html/rfc1928 sits in a lower layer)
Sorry, something went wrong.
|
The failing Node.js tests have this comment exactly for what this is fixing:
(which just means the tests are only documenting what undici currently does, and needs to be updated once undici fixes it, so failures here is to be expected). |
Sorry, something went wrong.
The forwarding fix from #5116 is in undici main but the embedded undici in nodejs/node still expects the old semantics, so the shared-builtin build fails until Node.js 26 ships a release embedding the updated undici. Comment is left in place to re-enable for Node.js 26 at that point. Node.js 24 stays off as the change is not being backported. Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Tunnel decision now depends on the request protocol only. HTTP requests through an HTTPS proxy use absolute-form request-target over TLS to the proxy instead of CONNECT, matching Node's built-in http.request and RFC 9112. HTTPS requests still tunnel via CONNECT. Http1ProxyWrapper pins the proxy SNI so the inner Client does not derive it from the rewritten Host header, and wraps ERR_TLS_CERT_ALTNAME_INVALID into SecureProxyConnectionError for parity with the tunneling path. Signed-off-by: Matteo Collina <hello@matteocollina.com>
The forwarding fix from #5116 is in undici main but the embedded undici in nodejs/node still expects the old semantics, so the shared-builtin build fails until Node.js 26 ships a release embedding the updated undici. Comment is left in place to re-enable for Node.js 26 at that point. Node.js 24 stays off as the change is not being backported. Signed-off-by: Matteo Collina <hello@matteocollina.com>
|
@metcoder95 @trivikr one last approve before me landing this? |
Sorry, something went wrong.
undici 8.7.0 (nodejs/undici#5116) changed the default so a plain HTTP request through an HTTP proxy forwards an absolute-form request instead of tunneling via CONNECT. The ProxyAgent CONNECT-span regression test then sees no CONNECT request at all and fails asserting a finished CONNECT span. Passing proxyTunnel: true restores the tunnel; the option is a no-op on undici < 6.22.0, where CONNECT was always used. Refs: nodejs/undici#5116
undici 8.7.0 (nodejs/undici#5116) changed the default so a plain HTTP request through an HTTP proxy forwards an absolute-form request instead of tunneling via CONNECT. The ProxyAgent CONNECT-span regression test then sees no CONNECT request at all and fails asserting a finished CONNECT span. Passing proxyTunnel: true restores the tunnel; the option is a no-op on undici < 6.22.0, where CONNECT was always used. Refs: nodejs/undici#5116
undici 8.7.0 (nodejs/undici#5116) changed the default so a plain HTTP request through an HTTP proxy forwards an absolute-form request instead of tunneling via CONNECT. The ProxyAgent CONNECT-span regression test then sees no CONNECT request at all and fails asserting a finished CONNECT span. Passing proxyTunnel: true restores the tunnel; the option is a no-op on undici < 6.22.0, where CONNECT was always used. Refs: nodejs/undici#5116
| Back | FazBrowse Home | New Git URL |
This relates to...
Fixes #5093
Rationale
EnvHttpProxyAgent currently inherits ProxyAgent's tunneling behavior. For plain HTTP targets reached through an HTTP proxy, defaulting to CONNECT can break proxies that do not implement tunneling and can lead to the looping behavior reported in #5093.
Per RFC 9112 §3.2.2, the tunnel-vs-forward decision depends only on the request protocol, not the proxy protocol. This matches Node's built-in http.request / https.request.
Behavior
proxyTunnel: true still forces CONNECT for plain HTTP requests.
Changes
Bug Fixes
Breaking Changes and Deprecations
HTTP request through an HTTPS proxy now forwards instead of tunneling by default. Matches Node's built-in behavior and the RFC. Pass proxyTunnel: true to restore the previous behavior.
Status