no_proxy env ignored on 302 redirect
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 54.3k
- Forks
- 10.4k
- Avg merge
- 16h 43m
- Merged PRs (30d)
- 3
Description
Hello,
I have a weird problem using Requests and proxies.
I have https_proxy and no_proxy env variable for a domain and it seems the no_proxy is ignored on a HTTP 302 redirect target.
What I do is basically:
s = requests.Session()
r = s.get("https://use-the-proxy.com")
The response is 302 Found (Location: https://do-not-use-the-proxy.com) and Requests tries to follow.
Here the problem: even if do-not-use-the-proxy.com is present in no_proxy, Requests still use the proxy for the request following a 302(the 302 "target").
If I directly request https://do-not-use-the-proxy.com, the proxy is not used as expected.
Thanks,
Nico
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the requests.Session and s.get call shown in the report, reproducing the HTTP 302 from use-the-proxy.com to do-not-use-the-proxy.com with https_proxy and no_proxy configured. Trace redirect handling and verify that the redirect target honors no_proxy while direct requests to that target continue to bypass the proxy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100