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
Proxy support does not work properly with CONNECT on https requests #4531
Comments
FWIW, https://github.com/thib3113/axios-proxy-tunnel/blob/master/src/axios-proxy-tunnel.ts is an example that works with an older version of axios, doing a modification of axiosProxyTunnel is a usable workaround |
This problem has existed for a long time, hope it will be solved |
I've also faced this issue. Here is example of usage:
|
- Resolve axios/axios#4531
Why is the "possible bug" label removed? Clearly the automatic proxy configuration is incorrect. If the protocol is HTTPS and the |
Is there an update for this issue? which axios version should we use to workaround? |
This worked for me:
|
If anyone is interested in trying out HTTPS-over-HTTP support in Axios, feel free to check #5037. The implementation has some limitations (no redirects) but maybe it still fits your use cases. Would love to hear back from you! Edit: Not directly related to this issue, but please note that there is currently (as of 1.1.2) some trouble around a breaking change in the proxy configuration: #5079 |
feat:添加enforce参数,区分处理时机 chore:axios版本暂时固定最0.27.2,新版本设置rejectUnauthorized:false时,不生效 axios/axios#4531
that didn't work with me, got 407 from proxy, although no proxy auth required, |
Can we just use proxy-agent to fix this ? With this module we could have all proxy features enabled automatically. I was having the same problem, and now everything works when i replace the agent.
const axios = require("axios").default;
const { ProxyAgent } = require("proxy-agent");
async function call() {
const url = "https://api64.ipify.org?format=json";
const agent = new ProxyAgent();
const res = await axios.get(url, { httpAgent:agent, httpsAgent:agent, proxy: false });
console.log(res.data);
}
call(); HTTPS_PROXY=http://proxy:3128 node example.js |
Yes, you can pass in a working agent implementation yourself. The problem is that Axios currently has a built-in implementation that is broken, so if you have the HTTPS_PROXY environment variable set it will fail by default. |
Yes @Nevon, but i think axios could use proxy-agent internally. There is no need to have a built-in implementation of this. Even if the proxy is not very difficult to understand, there is a lot of little details that can lead to multiple kind of bugs. |
Is there any progress on this issue?
Please fix this as this plays a central role in corporate environments. |
Describe the bug
Using Axios 0.26.1 behind a corporate HTTP tunneling proxy to an HTTPS destination, once the proxy connection is made, a POST method is issued, rather than a CONNECT to establish the TLS tunnel to the destination host where the POST should be sent. Result is Error: socket hang up, as the proxy expects a CONNECT to be issued and drops the connection
Specifically, using wireshark to monitor the activity of the script goes as follow:
If you use curl with the same environment, the packets are as follows:
To Reproduce
Expected behavior
When connecting to an HTTPS server through a tunneling HTTP proxy, the CONNECT method should be used to establish the TLS handshake before issuing the POST
Environment
The text was updated successfully, but these errors were encountered: