XMLHttpRequest - SEC7127:CORS 请求的重定向被阻止

2022-01-15 00:00:00 cors xmlhttprequest jquery ajax

当我第一次在 IE11 上访问我们的网页时,我遇到了以下错误.它适用于我机器上的 Chrome,但不适用于其他开发人员的机器.但是在所有情况下刷新页面时它都有效.

I am getting below error when I visit our webpage first time on IE11. It works in Chrome on my machine but doesn't work on other developer's machine. But it works when page is refreshed in all cases.

错误是

SEC7118:https://secure.server.com/esi?isie789=n&_=1403623253418 需要跨域资源共享 (CORS).

SEC7118: XMLHttpRequest for https://secure.server.com/esi?isie789=n&_=1403623253418 required Cross Origin Resource Sharing (CORS).

SCRIPT7002:XMLHttpRequest:网络错误 0x2ef1,由于错误 00002ef1,无法完成操作.SEC7127:CORS 请求的重定向被阻止.

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef1, Could not complete the operation due to error 00002ef1. SEC7127: Redirect was blocked for CORS request.

它是使用 Ajax jquery 调用的.

It is being called using Ajax jquery.

    $.ajax({
        url: esiUrl,
        type: 'GET',
        data: "isie789=" + isIE789,
        dataType: 'html',
        cache: false,
        success: function(responseText) {
            if(responseText.length > 0) {
                $("#deal-of-day-esi").replaceWith(responseText);
            }
        },
        error: function() {
        }
    });

查看 IE11 中的请求/响应标头 - 我没有看到任何标头.但是在刷新或在 Chrome、Firefox 中,我们确实看到了响应标头低于值

Looking into to request/response headers in IE11 - I don't see any. But on refresh or in Chrome, Firefox we do see response headers with Below values

访问控制允许凭据:true访问控制允许来源:http://www.server.co.uk

Access-Control-Allow-Credentials:true Access-Control-Allow-Origin:http://www.server.co.uk

你能帮忙吗?

推荐答案

我在任何地方都找不到这个文档,但在我的测试中似乎:

I can't find this documented anywhere, but in my testing it appears that:

XMLHttpRequest:网络错误 0x2ef1

XMLHttpRequest: Network Error 0x2ef1

特指混合模式错误;例如,当 https 站点提供重定向到 http 站点的请求时.

specifically refers to a mixed mode error; for example when an https site serves a request to redirect to an http site.

相关文章