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:
export const axiosAgent = axios.create({
baseURL: "http://xxx.xxx.xxx/api/v1/",
});
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:
Provisional headers are shown
Accept: application/json, text/plain, */*
Access-Control-Allow-Origin: *
Referer: http://localhost:3000/patients
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
and there is no response header.
and now I get net::ERR_SSL_PROTOCOL_ERROR
Insecure content)net::ERR_NAME_NOT_RESOLVEDjust because of a protocol difference.https://xxx.xxx.xxx:8080/api/v1/operator/patient, But as I said, I create axios withhttpand in browser it changed tohtttps. I don't know really what is happening.Sometimesnet::ERR_NAME_NOT_RESOLVEDand sometimesnet::ERR_SSL_PROTOCOL_ERROR, but main point is to disable redirect tohttps.