Skip to content

Support CIDR notation in NO_PROXY env variable - #131397

Merged
MihaZupan merged 2 commits into
dotnet:mainfrom
SapiensAnatis:cidr-no-proxy-support
Jul 27, 2026
Merged

Support CIDR notation in NO_PROXY env variable#131397
MihaZupan merged 2 commits into
dotnet:mainfrom
SapiensAnatis:cidr-no-proxy-support

Conversation

@SapiensAnatis

Copy link
Copy Markdown
Contributor

CIDR notation like 127.0.0.0/8 in the NO_PROXY/no_proxy environment variables is currently not handled. These entries will be silently ignored because only exact entries like 127.0.0.1 can cause HttpEnvironmentProxy.IsBypassed to return true.

Address this by introducing support for IPv4 and IPv6 CIDR notation into HttpEnvironmentProxy. The CIDR parsing is done at construction-time to minimize the time spent parsing on each individual HTTP request. Additionally, CIDR-based matching will not be performed unless at least one CIDR block is actually present in NO_PROXY.

Fix #131293

CIDR notation like 127.0.0.0/8 in the `NO_PROXY`/`no_proxy`
environment variables is currently not handled. These entries will be
silently ignored because only exact entries like 127.0.0.1 can cause
`HttpEnvironmentProxy.IsBypassed` to return `true`.

Address this by introducing support for IPv4 and IPv6 CIDR notation into
`HttpEnvironmentProxy`. The CIDR parsing is done at construction-time
to minimize the time spent parsing on each individual HTTP request.
Additionally, CIDR-based matching will not be performed unless at least
one CIDR block is actually present in `NO_PROXY`.

Fix dotnet#131293
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 26, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@MihaZupan MihaZupan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
@SapiensAnatis

Copy link
Copy Markdown
Contributor Author

I don't think that build failure is caused by my changes. I'm new to this repo, so I'm not sure what the process is, but let me know if I need to rebase or merge main.

@MihaZupan
MihaZupan requested a review from a team July 27, 2026 08:51
@MihaZupan

MihaZupan commented Jul 27, 2026

Copy link
Copy Markdown
Member

No need to do anything on your part, the PR just needs a secondary review since I also made changes.

Some tests aren't always stable, so this repo uses "Build Analysis" (you can see it under the passing checks) to detect when unknown failures occurred that should block the PR from being merged.

@MihaZupan
MihaZupan merged commit 3d59a08 into dotnet:main Jul 27, 2026
82 of 84 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-rc1 Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net.Http community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for CIDR notation in the NO_PROXY environment variable

3 participants