Skip to content
Advertisement

Axios change http to https

I have server that accept only http (no https). And when I call an api, axios automatically change http to https.

I create axios instance here:

JavaScript

But in browser http changes to https, so it become: https://xxx.xxx.xxx/api/v1/all

and I get net::ERR_NAME_NOT_RESOLVED

How can I prevent that?

UPDATE Request Header:

JavaScript

and there is no response header.

and now I get net::ERR_SSL_PROTOCOL_ERROR

Advertisement

Answer

I just remove <meta http-equiv="Content-Security-Policy" content="default-src 'self'"> from head in html. and problem solved. This meta tag change all http request to https one, so this is not related to axios.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement