![](/img/trans.png)
[英]The page at was loaded over https but requested an insecure xmlhttprequest endpoint
[英]The page at 'website' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'website'
我有以下 axios 請求,該請求將通過 https 發出,但出現錯誤
The page at 'http://websitename/folder1/folder2/api/atlas/home/coach' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://websitename/folder1/folder2/api/user?userid=15'. This request has been blocked; the content must be served over HTTPS.
Axios 請求者
loadUser() {
this.memberid = this.$route.params.userid;
if (axios == null) {
return;
}
axios
.get('https://websitename/folder1/folder2/api/atlas/api/user/', {
params: {
userid: this.loggedinuser
}
})
.then(res => {
this.user = res.data.user[0].name;
})
.catch(err => {
console.log(err);
});
}
In the network logs, I can see the request URL is going over HTTPS, but the Response header is http in the location field. 請問我該如何解決?
添加<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
解決了這個問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.