]> git.kaiwu.me - njs.git/commit
Modules: skip the proxy CONNECT tunnel when no proxy is selected master
authorbasavaraj-sm05 <basavaraj@digiscrypt.com>
Sat, 21 Nov 2026 12:31:38 +0000 (18:01 +0530)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 25 Nov 2026 06:09:18 +0000 (22:09 -0800)
commitbfb44bbbe8b98e5d4bfb7e0f01404d7f2b0b0bee
treef344f6c71f7a625d9926abffeade43f919bdf318
parent997957b3dbc7716344b8c9747e96bd04f3102a30
Modules: skip the proxy CONNECT tunnel when no proxy is selected

ngx_js_http_connect() and the write handler chose between a forward
proxy CONNECT tunnel and a direct TLS handshake from
ngx_js_conf_proxy(), which only reports that js_fetch_proxy is
configured for the location.

When the proxy URL comes from a variable it is evaluated per request
and an empty value selects a direct connection.  An "https" fetch in
such a location then connected to the origin while still being
treated as proxied: the cleartext CONNECT request was written to the
origin and the TLS handshake was never started.

Use ngx_js_http_proxy(), the per-request state the rest of the fetch
code already uses, in the connect and write paths.  A static
js_fetch_proxy is unaffected because both predicates agree there.
nginx/ngx_js_http.c
nginx/t/js_fetch_proxy_https.t