Fixing http adapter to allow HTTPS connections via HTTP#959
Fixing http adapter to allow HTTPS connections via HTTP#959JustinBeckwith merged 1 commit intoaxios:masterfrom
Conversation
e6c944f to
486c956
Compare
|
@mzabriskie When is this going to get merged and released? I need it for a project I'm working on and will need to move to something else if it's not going to be soon |
Implemented changes from axios#959
|
Please merge this, for now, we have to use the contentful |
|
Please remove all changes relating the package.json and the generated files in |
index.d.ts
Outdated
| export interface AxiosProxyConfig { | ||
| host: string; | ||
| port: number; | ||
| isHttps?: boolean; |
There was a problem hiding this comment.
I'd use a protocol option instead, accepting both http and http: formats so parsed URL can be passed as the proxy option.
lib/adapters/http.js
Outdated
| } | ||
|
|
||
| var transport; | ||
| var useHttps = isHttps && (proxy ? proxy.isHttps : true); |
There was a problem hiding this comment.
I'd use isHttpsProxy instead as it's clearer.
|
Please merge this, I need this behavior for my project. I switched to axios from request.js recently. I don't wanna do any doubts/ in my decision. |
486c956 to
e9a9c62
Compare
|
<3 |
|
Please merge this, i need this for a project that i working on. |
|
Can we get this merged? We're also having issues with this, and are using a fork for now. |
|
FWIW: It would be excellent to see this merged in sometime :) |
|
Doesn't fix the real problem for me. Instead, fails with a nicer (and faster) error:
|
|
@mrchief are you trying to connect to an HTTP endpoint through an HTTPS proxy? Do you have a small code snippet that fails? |
|
@zcei I was using Fiddler proxy. I set it up to decrypt HTTPS traffic so that it listens for https requests. I don't have any small snippet but it should be reproducible fairly easily by:
The request should fail with above error. |
|
@mrchief Did you pass it like this literal value? |
|
Tried passing it as |
|
It seems passing it on the I was trying to set it on the instance before: The readme indicates that the same config can be used (for It might help to separate them if that's the case, i.e create config is not the same as request config. The same thing without your patch gives me this error: So I guess your patch does work! :) |
|
@mrchief thanks for the additional info! 🙏 The Glad you faced it, though, so other people can refer to your findings in case they face it as well. |
Summary
We are using axios at Contentful for both our JS SDKs contentful.js and contentful-management.js.
Axios was assuming always that the
proxyprotocol is the same as the URL it is requesting. This a problem when you use ahttpproxy when requesting data fromhttpsendpoint.see more at #925 and #753
Purpose of the PR
This PR make
httpAdapterto allow https connections via http by introducing a new config param to theproxyobject calledisHttpswhich defaults to falseTODO