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 protocol https not found issue #1904
Conversation
Nice fix! Would it be better to add the Line 173 in 5d242ce
That way it will only be added if the |
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.
Tested the change and found working.
Test URL that redirects from https to http : https://www.thinkadvisor.com/search/?q=insure
mark |
Known issue: `Protocol "http:" not supported. Expected "https:"`. More details: axios/axios#1904 (comment)
Fixes #768
Axios determines
isHttpsRequest
based on the protocol in the url. So for urls beginning withhttp://
, it will try to use anhttpAgent
. Then, if the url internally redirects to https, it throws the "Protocol https not supported" error in the issue above. This only happens when a customhttpAgent
is supplied to axios.To fix, we just need to pass both agents to
follow-redirects
and let that package choose based on what protocol it encounters https://github.com/follow-redirects/follow-redirects/blob/v1.4.1/index.js#L121