NO_PROXY=example.com does not bypass subdomains for http.request(), unlike fetch()
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
Bắt đầu với hành vi của repro.js và entry point http ProxyConfig#shouldUseProxy; so sánh nó với EnvHttpProxyAgent của fetch() và tài liệu NO_PROXY. Hoàn tất khi một entry example.com đơn giản bỏ qua các subdomain của nó theo ranh giới label, đồng thời http.request() và fetch() cho kết quả nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
v24.18.1, also on main (v27.0.0-pre)
Platform
Darwin xxx.local 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000 arm64
Subsystem
http
What steps will reproduce the bug?
Dead proxy on port 1 — the error code shows where the request went:
NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://127.0.0.1:1 NO_PROXY=example.com node repro.js
const http = require('node:http');
http.get('http://internal.example.com/').on('error', (e) => console.log(e.cause?.code ?? e.code));
// ECONNREFUSED — went through the proxy
fetch('http://internal.example.com/').catch((e) => console.log(e.cause?.code ?? e.code));
// ENOTFOUND — bypassed, hit DNS
How often does it reproduce? Is there a required condition?
Always, when the NO_PROXY entry has no leading dot and the request host is a subdomain of that entry.
What is the expected behavior? Why is that the expected behavior?
Same NO_PROXY in the same process should mean the same thing for http.request() / http.get() and fetch(). http.setGlobalProxyFromEnv() and the docs present one NO_PROXY format for both.
fetch() (undici EnvHttpProxyAgent) already treats a plain example.com as the host and its subdomains, with a label boundary so notexample.com does not match. http should do the same.
What do you see instead?
ProxyConfig#shouldUseProxy exact-matches a plain entry against the hostname. NO_PROXY=example.com therefore does not bypass internal.example.com for http.request(), while fetch() does.
The docs currently describe this as “Exact host name match”, which matches the http implementation and not fetch().
Additional information
Refs: #57872, #62907
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.4k
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 279
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
doc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
build
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
palladius/rails8-app-on-gcp#145 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
web-platform-tests/interop#1455 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
corsairdev/corsair#1764 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100