我有只接受http(沒有https)的服務器。當我調用 api 時,axios 會自動將 http 更改為 https。我在這里創建axios實例:export const axiosAgent = axios.create({ baseURL: "http://xxx.xxx.xxx/api/v1/",});但是在瀏覽器中,http 更改為 https,因此它變為:https://xxx.xxx.xxx/api/v1/all我得到net::ERR_NAME_NOT_RESOLVED我該如何防止這種情況?更新請求標頭: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并且沒有響應標頭。現在我得到net::ERR_SSL_PROTOCOL_ERROR
Axios 將 http 更改為 https
皈依舞
2022-08-18 16:10:19