-
-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol not parsed when setting proxy config from env vars #3070
Conversation
I just realized this PR is a dupe of #2562. I would still pull this one in though since it includes unit tests. |
+1, @jonathanfoster was just considering creating PR myself until I came across yours. Adding protocol supports will provide parity with deprecated requests project. Any idea when this will be merged? |
Looks like @chinesedfan removed the work in progress label a few days ago. I’m not sure what the workflow is like, but this makes me think it won’t make it into the next release. @chinesedfan or @jasonsaayman, can you guys provide an update? Anything else we need to do to ship this PR? |
I think it will make it into the next release, I am starting to collect pull requests for 0.21 should get here soon. Thanks |
@jasonsaayman Looks like this one didn't make it into 0.21. Anything I can do to help get it in 0.22? This PR fixes a huge pain point for anyone using axios behind a corporate proxy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, has tests, and does not seem to break backward compatibility.
@chinesedfan can you have a look let me know if we can merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, except for a few suggestions.
It looks like all the requested changes have been completed @chinesedfan. Bumping this thread as a follow up. |
* Fixing proxy protocol config when parsed from env vars * Adding instructions to specify proxy protocol when setting proxy config * Moved HTTPS proxy config instruction closer to example * Clear https_proxy env var so as to not impact other tests
This PR resolves the issue when setting proxy config from env vars, the proxy config protocol is not set based on the env var URL. This causes all proxy server connections to use HTTP and results in invalid request errors.
If you set HTTPS_PROXY to an HTTPS URL...
export HTTPS_PROXY=https://localhost:8080
then the proxy config will be set without protocol, which is used later on to initiate the proxy connection.
The proxy config should include protocol when parsing from env vars.
To reproduce this issue, create a local HTTPS proxy with mitmproxy and set
HTTPS_PROXY
to https://localhost:8080. mitmproxy will respond with a 400 and the error messageHTTP protocol error in client request: Invalid request scheme: https
.