我有只接受http(沒有https)的服務(wù)器。當(dāng)我調(diào)用 api 時,axios 會自動將 http 更改為 https。我在這里創(chuàng)建axios實例:export const axiosAgent = axios.create({ baseURL: "http://xxx.xxx.xxx/api/v1/",});但是在瀏覽器中,http 更改為 https,因此它變?yōu)椋篽ttps://xxx.xxx.xxx/api/v1/all我得到net::ERR_NAME_NOT_RESOLVED我該如何防止這種情況?更新請求標(biāo)頭:Provisional headers are shownAccept: application/json, text/plain, */*Access-Control-Allow-Origin: *Referer: http://localhost:3000/patientsUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36并且沒有響應(yīng)標(biāo)頭?,F(xiàn)在我得到net::ERR_SSL_PROTOCOL_ERROR
Axios 將 http 更改為 https
皈依舞
2022-08-18 16:10:19