How to use axios with a proxy server to make an https call?

if you want to use axios and work-around the issue then consider using https-proxy-agent for proxy agent as mentioned in link

    const HttpsProxyAgent = require("https-proxy-agent"),
      axios = require("axios");

const httpsAgent = new HttpsProxyAgent({host: "proxyhost", port: "proxyport", auth: "username:password"})

//use axios as you normally would, but specify httpsAgent in the config
axios = axios.create({httpsAgent});

axios's config.proxy is Node.js only. I think it is meaningless in browsers.

You can check lib/adapters/xhr.js and will find nothing related to proxy there.


There is an open issue on axios's github page.

The issue is labeled as bug from 31 Mar and is not resolved yet.

So it seems you are not cursed, just a bug in axios.

You may add your details to that thread in order to dev team prioritize this issue.

In case you cannot wait for this issue to be resolved, you may consider using fetch API like @Sumi Straessle proposed in the comments.