我有以下代码和相关错误:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
product_prices = this.responseText;
}
};
xhttp.open("GET", ("https://example.com/" + products), true);
xhttp.send();
chrome中的错误:
Mixed Content: The page at 'https://example.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://example.com/1_/'. This request has been blocked; the content must be served over HTTPS.
XHR failed loading: GET "http://example.com/1_/".
XHR failed loading: GET "https://example.com/1_/".
开发工具的网络部分还显示正确的https请求状态为:已取消
如果使用了相对网址,即使网页使用https,也会通过http发送请求。
服务器是django应用程序,SECURE_SSL_REDIRECT = True