Skip to content
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

Fixing HTTPS proxy from env #2933

Closed
wants to merge 1 commit into from
Closed

Conversation

tonywanteeed
Copy link

Inside the http adapter we use a check on proxy.protocol to determine
whether to use HTTP or HTTPS transport
This works fine when we use a protocol key in the proxy
configuration object
However when the proxy configuration comes from the http_proxy or
https_proxy environment variable, we parse the URL to set the host
and port keys in the proxy configuration but the protocol is never
extracted from that URL thus causing HTTPS requests to always use HTTP
transport.

I've tried to add some tests to test/unit/adapters/http.js to validate the fix but it requires both the server and the proxy to use HTTPS. As the other tests seems to focus on HTTP proxies and servers I don't know how to add those.
I'm willing to work on them if you can point me in the right direction.

Inside the http adapter we use a check on `proxy.protocol` to determine
whether to use HTTP or HTTPS transport
This works fine when we use a `protocol` key in the `proxy`
configuration object
However when the proxy configuration comes from the `http_proxy` or
`https_proxy` environment variable, we parse the URL to set the `host`
and `port` keys in the proxy configuration **but** the protocol is never
extracted from that URL thus causing HTTPS requests to always use HTTP
transport.
@Tchoupinax
Copy link

Same as #2562

@jasonsaayman
Copy link
Member

Hi @tonywanteeed,

Firstly thanks for the contribution, but this seems to be a duplicate of #2562 so I am going to close it due to it being a duplicate. Please feel free to help with other issues if you would like.

@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants