Skip to content

fix: plain domain entries should match subdomains#12

Open
vparfonov wants to merge 1 commit into
jdrouet:mainfrom
vparfonov:sub-domain
Open

fix: plain domain entries should match subdomains#12
vparfonov wants to merge 1 commit into
jdrouet:mainfrom
vparfonov:sub-domain

Conversation

@vparfonov
Copy link
Copy Markdown

@vparfonov vparfonov commented May 6, 2026

Summary

  • Plain domain entries like example.com now match the domain itself and all subdomains (e.g. sub.example.com), aligning with Go's httpproxy, curl, Python, and Ruby conventions
  • The leading-dot form .example.com continues to match subdomains only (not the domain itself), preserving a useful distinction
  • Updated existing tests and added new plain_domain_matches_subdomains test

Problem

NoProxyItem::Plain performed exact string comparison only:
Self::Plain(source) => source == value, this meant no_proxy=apps.example.com would not bypass the proxy for elasticsearch.apps.example.com, contradicting all major NO_PROXY implementations and the GitLab standardization
proposal which states: "Suffixes are always matched (e.g. example.com will match test.example.com)"
https://about.gitlab.com/blog/we-need-to-talk-no-proxy/

Fix

Self::Plain(source) => {
      source == value || value.ends_with(&format!(".{source}"))
  }

Should fix: #11

   A plain domain like `example.com` in the no_proxy list now matches
   both the domain itself and all subdomains (e.g. `sub.example.com`),
   aligning with Go's httpproxy, curl, Python, and Ruby conventions.

   Previously, `Plain` variant did exact string match only, which
   contradicted the GitLab NO_PROXY standardization proposal that
   this crate references.

   The leading-dot form `.example.com` continues to match subdomains
   only (not the domain itself), preserving a useful distinction.
@vparfonov
Copy link
Copy Markdown
Author

@jdrouet can you please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plain domain entries should match subdomains

1 participant