![](/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.