Axios Proxy Issues - 501 and SSL errors
See original GitHub issueDescribe the bug
Getting weird error messages when passing a proxy into an Axios request. I’ve tried to add a proxy
parameter to the following GET
request and I get a 501
error code and when I then add a protocol
parameter to the proxy
object I get an openssl
error
Note that I don’t have any of these issues when using the library axios-https-proxy-fix
, https://www.npmjs.com/package/axios-https-proxy-fix
To Reproduce
axios
.get(prod, {
proxy: {
host: proxy.host,
port: proxy.port,
auth: {
username: proxy.userName,
password: proxy.password,
},
}
})
Then I tried adding protocol
to the proxy
object, like so:
axios
.get(prod, {
proxy: {
protocol: "https",
host: proxy.host,
port: proxy.port,
auth: {
username: proxy.userName,
password: proxy.password,
},
}
})
Error:
write EPROTO 17828:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
Expected behavior
No 501
and no openssl
issues. Should get a 200
response.
Environment
- Axios Version 0.21.0
- Node.js Version 12.17
- OS: Windows 10
Additional context/Screenshots
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:29
- Comments:20 (1 by maintainers)
Top Results From Across the Web
How to use axios to make an https call? - Stack Overflow
Axios https proxy support is borked if using https proxies. Try passing the proxy through httpsProxyAgent using http.
Read more >How to Fix the HTTP 501 Not Implemented Error on Your Site
The HTTP 501 Not Implemented status code indicates that the server does not support the functionality required to fulfill the request.
Read more >501 Not Implemented - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 501 Not Implemented server error response code means that the server does not support the ...
Read more >ssl wrong version number | The Search Engine You Control
This line seems to be the problem: ssl_version=ssl.PROTOCOL_TLSv1 . ... It seems both stages need to have access of the proxy envs.
Read more >503 Service Unavailable Error: What It Is and How to Fix It
A close look at what a 503 Service Unavailable Error is, including troubleshooting tips to help you resolve this error in your own ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Until a proper fix is implemented in the library, here is the workaround I used:
Note that
proxy
must be set to false otherwise the adapter will try to initialize it again from the environment variable.For a complete example (with proxy and no proxy): https://github.com/spectrocloud/k8s-set-context/blob/690044f1c02048af0e4b7470dd70306ef1f4556b/src/client.ts#L36-L54
Not working for me either, please fix