httpsAgent does not work in combination with an HTTP-proxy.
See original GitHub issueDescription
I try to setup HTTPS-session using Axios which works fine through Fiddler. This fails by the way on the current stable release v0.18.0, I guess this is issue #925, fixed in #959.
As soon as I remove Fiddle, it no longer works. I suspect that it is, because the connection is pooled by Fiddler. So in order to make it work without the Fiddler proxy, I inject httpsAgent to keep the connection alive e.g.:
import * as http from 'https';
import * as https from 'https';
const Fiddler = {
host: '127.0.0.1',
port: 8888
};
this.axios = Axios.create({
proxy: Fiddler
httpAgent: new http.Agent({keepAlive: true}),
httpsAgent: new https.Agent({keepAlive: true, rejectUnauthorized: false})
I can’t get it work with the https-agent assigned, not with a proxy:
Stacktrace:
TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
at new ClientRequest (_http_client.js:118:11)
at Object.request (http.js:41:10)
at RedirectableRequest._performRequest (node_modules\follow-redirects\index.js:186:24)
at new RedirectableRequest (node_modules\follow-redirects\index.js:69:8)
at Object.wrappedProtocol.request (node_modules\follow-redirects\index.js:363:14)
at dispatchHttpRequest (node_modules\axios\lib\adapters\http.js:180:25)
at new Promise (<anonymous>)
at httpAdapter (node_modules\axios\lib\adapters\http.js:20:10)
at dispatchRequest (node_modules\axios\lib\core\dispatchRequest.js:59:10)
Not without a proxy.
Context
- axios version: e.g.: (v0.19.0-beta.1)[https://github.com/axios/axios/releases/tag/v0.19.0-beta.1]
- Environment: e.g.: node v10.13.0, Windows 10
Related issues
- #1885 (that one using a socks proxy, therefor I consider this one to be different)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Why does https.Agent throw a parse error when proxying via ...
(I've elided the complementary http agent for brevity.) I create a proxy server, as such: const proxy = httpProxy.createProxyServer({});.
Read more >Certificate error when using HTTPS proxy with self-signed ...
It supports self-signed certificates without proxy or proxy with normal CA certificates, but not the combination of proxy + self-signed.
Read more >How to make HTTPS request through HTTP proxy with Axios
I was passing both HTTPS_PROXY and https_proxy environment variable to docker run in hope that Axios would pick one up but this didn't...
Read more >http-proxy-middleware - npm
The one-liner node.js proxy middleware for connect, express and browser-sync. Latest version: 2.0.6, last published: 8 months ago.
Read more >How to use a proxy with node-fetch? - ScrapingBee
Unfortunately, Node-fetch does not natively support proxies. But there is a work-around. By using the node-https-proxy-agent, you will be able ...
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 FreeTop 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
Top GitHub Comments
waiting for the new release 😃
I have opened a PR to fix this issue : https://github.com/axios/axios/pull/2426