fix: handle leading-dot NO_PROXY entries matching apex domain

`.slack.com` in NO_PROXY should match both `slack.com` (apex) and
`wss-primary.slack.com` (subdomain). Strip the leading dot before
comparison so the suffix check works for both cases.
This commit is contained in:
Michael Martello
2026-04-08 03:55:52 +00:00
committed by Peter Steinberger
parent 4ab6a7b324
commit 5609a35f67

View File

@@ -31,8 +31,10 @@ function isHostExcludedByNoProxy(
if (entry === "*") {
return true;
}
// Exact match or suffix match (with leading dot)
if (lower === entry || lower.endsWith(entry.startsWith(".") ? entry : `.${entry}`)) {
// Strip optional leading dot for comparison so `.slack.com` matches both
// `slack.com` (apex) and `wss-primary.slack.com` (subdomain).
const bare = entry.startsWith(".") ? entry.slice(1) : entry;
if (lower === bare || lower.endsWith(`.${bare}`)) {
return true;
}
}