question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Respect system proxy exclusions.

See original GitHub issue
  • Initially raised as discussion #1513

We’re currently leaning on urllib.request.getproxies() to determine the system proxy setup, and setup which mounts should be a proxy transport and which should be a regular transport.

However, we’re not using urllib.request.proxy_bypass(host).

This all works as expected when environment settings are being used. HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY. In that case we’re reading NO_PROXY, and ensuring anything hostname patterns there are mounted as a regular transport…

https://github.com/encode/httpx/blob/68cf1ff88a7f6c0b084bb62455c043aa503713ef/httpx/_utils.py#L304-L320

However, in the case when none of those environment variables are set getproxies() instead falls back to system proxy configuration. For windows this is registry based. ProxyEnable and ProxyOverride. For Mac this is sysconf based. In those cases, we’re correctly getting the configured proxies, but we aren’t dealing with proxy exclusions.

We’d like to be able to setup these exclusions with our neat hostname pattern matched mounts system, which actually means we can’t just fallback to urllib.request.proxy_bypass(host), because that needs to be called per-host.

So, first steps…

  • What exactly is the format of the windows registry ProxyOverride field?
  • What exactly is the format of the “exceptions” field returned by from _scproxy import _get_proxy_settings()?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Jaharmicommented, May 22, 2021

Being able to pick up and use the system proxy settings — especially proxy auto config — would be a benefit in certain environments, even if it’s an option and not the default. I’m no longer in a situation like that, but Python PAC support on macOS could have made configuring some projects much easier. It might have been a reason to choose a library like HTTPX over another.

1reaction
tomchristiecommented, Mar 29, 2021

Sticking to environment only settings would be one option, yes, though I’m not convinced that’d be the best from a user-experiance point of view.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP-Proxy: Exceptions - WatchGuard Technologies
This topic describes how to use HTTP-proxy exceptions.
Read more >
We need to talk: Can we standardize NO_PROXY? - GitLab
You may be less familiar with no_proxy , which provides a way to exclude traffic destined to certain hosts from using the proxy....
Read more >
mz_http_proxy - Rust - Docs.rs
This crate constructs HTTP clients that respect the system's proxy ... With the exception of http_proxy , environment variables may be specified in...
Read more >
Adding or Updating a Proxy Server - VMware HCX
These local systems must be encompassed in the list of exclusions. See VMware KB article 89180. Site paired HCX Cloud Manager URLs must...
Read more >
Configuring Proxy Settings for All Apps | Pivotal Docs
Overview · Set Environment Variables · Troubleshooting. Exclude an App From Global Proxy Settings; Change Case of HTTP; Check Proxy Settings ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found