混合内容错误 (Http/Https)
Mixed Content Error (Http/Https)
我有混合内容错误,网站同时使用了 http 和 https 协议。
这是来自 Chrome 控制台的错误:
Mixed Content: The page at 'https://www.amazon.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.amazon.com/../?redirect=true'. This request has been blocked; the content must be served over HTTPS.
这是错误的屏幕截图:http://prntscr.com/9os5li
找到了一些解决方案,例如:
将 link 从 "http://" 更改为 "https://"
Blocked loading mixed active content.
没有任何帮助,因为当我从 http[=45= 更改代码或手册中的 link 时,Amazon 服务器总是放弃它] 到 https 删除它并使其成为 http.
例如这个Link 2我不能在这里使用https,因为这个我有混合内容错误。
这是我的 AJAX 我打电话的地方:
$.ajax({
url: "//" + MWS_URL + rest_path,
data: request,
dataType: 'text',
type: 'POST',
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
beforeSend: function(req) {
//req.setRequestHeader("User-Agent", "chrome extension");
req.setRequestHeader("x-amazon-user-agent", "chrome extension");
},
success: function(data){
if (onSuccess) {
onSuccess(data);
}
},
error: function(jqXHR, textStatus, errorThrown) {
if (onError) {
onError(jqXHR, textStatus);
}
}
});
setTimeout(callService, 1000);
}
要求:
requests.push(
$.get(link.URL, function (data) {
if (IsCancel()) {
return;
}
var jdata = $($.parseHTML(data));
var parser = new ProductPageParser(jdata, link.URL);
if (!parser.isValidProduct()) {
console.log(link.URL + " is not a valid product, skipped.");
link.processed = true;
return;
}
// Process associated (linked) product on this page according to user preferences.
crawlLinkedProducts(jdata, link.URL, config);
// Store product into a collection.
var product = getProductForParser(parser, link);
//product.dbRawProductURL = urlRaw;
if (product) {
products.push(product);
}
link.processed = true;
})
);
正如我在解析器中解析的那样,这是二级解析器。我在主页上解析了产品:
$(productUrls).each(function (index, link) {
if (!link.processed) {
console.log("Download second level -> " + link.URL);
requests_2level.push(
$.post(link.URL, "", function (data) {
if (IsCancel()) {
return;
}
console.log("End download second level -> " + link.URL);
var jdata = $($.parseHTML(data));
var parser = new ProductPageParser(jdata, link.URL);
if (!parser.isValidProduct()) {
console.log(link.URL + " is not a valid product, skipped.");
link.processed = true;
return;
}
var hackUrl = "//amazon.com/o/ASIN/" + parser.getAsin();
link.URL = hackUrl;
var product = getProductForParser(parser, link);
if (product) {
products.push(product);
}
link.processed = true;
})
);
}
});
有人知道如何解决这个问题吗?
决定是使用 http 还是 https,每次调用都使用相同的 on。
如果 Amazon 一直将您从 HTTPS 重定向到 HTTP,那么您将无能为力:
- 在亚马逊上抱怨得够厉害,他们才修好它或
- 使用差异化服务
我有混合内容错误,网站同时使用了 http 和 https 协议。
这是来自 Chrome 控制台的错误:
Mixed Content: The page at 'https://www.amazon.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.amazon.com/../?redirect=true'. This request has been blocked; the content must be served over HTTPS.
这是错误的屏幕截图:http://prntscr.com/9os5li
找到了一些解决方案,例如:
将 link 从 "http://" 更改为 "https://" Blocked loading mixed active content.
没有任何帮助,因为当我从 http[=45= 更改代码或手册中的 link 时,Amazon 服务器总是放弃它] 到 https 删除它并使其成为 http.
例如这个Link 2我不能在这里使用https,因为这个我有混合内容错误。
这是我的 AJAX 我打电话的地方:
$.ajax({
url: "//" + MWS_URL + rest_path,
data: request,
dataType: 'text',
type: 'POST',
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
beforeSend: function(req) {
//req.setRequestHeader("User-Agent", "chrome extension");
req.setRequestHeader("x-amazon-user-agent", "chrome extension");
},
success: function(data){
if (onSuccess) {
onSuccess(data);
}
},
error: function(jqXHR, textStatus, errorThrown) {
if (onError) {
onError(jqXHR, textStatus);
}
}
});
setTimeout(callService, 1000);
}
要求:
requests.push(
$.get(link.URL, function (data) {
if (IsCancel()) {
return;
}
var jdata = $($.parseHTML(data));
var parser = new ProductPageParser(jdata, link.URL);
if (!parser.isValidProduct()) {
console.log(link.URL + " is not a valid product, skipped.");
link.processed = true;
return;
}
// Process associated (linked) product on this page according to user preferences.
crawlLinkedProducts(jdata, link.URL, config);
// Store product into a collection.
var product = getProductForParser(parser, link);
//product.dbRawProductURL = urlRaw;
if (product) {
products.push(product);
}
link.processed = true;
})
);
正如我在解析器中解析的那样,这是二级解析器。我在主页上解析了产品:
$(productUrls).each(function (index, link) {
if (!link.processed) {
console.log("Download second level -> " + link.URL);
requests_2level.push(
$.post(link.URL, "", function (data) {
if (IsCancel()) {
return;
}
console.log("End download second level -> " + link.URL);
var jdata = $($.parseHTML(data));
var parser = new ProductPageParser(jdata, link.URL);
if (!parser.isValidProduct()) {
console.log(link.URL + " is not a valid product, skipped.");
link.processed = true;
return;
}
var hackUrl = "//amazon.com/o/ASIN/" + parser.getAsin();
link.URL = hackUrl;
var product = getProductForParser(parser, link);
if (product) {
products.push(product);
}
link.processed = true;
})
);
}
});
有人知道如何解决这个问题吗?
决定是使用 http 还是 https,每次调用都使用相同的 on。
如果 Amazon 一直将您从 HTTPS 重定向到 HTTP,那么您将无能为力:
- 在亚马逊上抱怨得够厉害,他们才修好它或
- 使用差异化服务