I just tried all the solutions above but nothing works even with the HttpsProxyAgent
and I realised that my case, I use the corp proxy for both HTTP and HTTPS
so, I give it a try for HTTPProxyAgent
This time, it works. Not really understand why ~ Please advise me if you got something for this
My code for reference
// Proxy with HttpProxyAgent
const {HttpProxyAgent} = require('http-proxy-agent');
const proxyUrl = 'http://myUser:myPass@proxyIP:port';
const httpProxyAgent = new HttpProxyAgent(proxyUrl);
// Axios POST call with HttpProxyAgent
axios.post(url, body, {
httpAgent: httpProxyAgent,
proxy: false, // Proxy won't work if I don't force disabling default axios proxy ,
if you know why please advise me
});
P/s: I think might be the cause can come from using http
or https
in proxyUrl
I mean for HttpProxyAgent
I should use http
and HttpsProxyAgent
I should use https
Please advise me if you have an answer for this