IE10跟随HTTP 302重定向两次

时间:2013-08-13 19:30:11

标签: internet-explorer redirect

我遇到IE10的以下问题(其他浏览器如Firefox,Opera,Chrome和旧的IE版本似乎没有受到影响。

(1)浏览器点击一个页面,该页面以HTTP 302重定向到另一个站点进行响应(为了执行登录):

请求:

GET https://www.domain-one.de/startpage.aspx?... HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: de-DE
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Accept-Encoding: gzip, deflate
DNT: 1
Host: www.domain-one.de
Pragma: no-cache
Connection: Keep-Alive
Cookie: ...

响应:

HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=utf-8
Location: https://login.domain-two.com/login?tid=hGZmFb77-9VyiwfkhIXIRMDp
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
P3P: CP="NOi CURa TAIa OUR NOR UNI"
Date: Tue, 13 Aug 2013 19:01:22 GMT
Content-Length: 190

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://login.domain-two.com/login?tid=hGZmFb77-9VyiwfkhIXIRMDp">here</a>.</h2>
</body></html>

(2)IE遵循此重定向。服务器设置一些coookies并重定向回原始站点:

请求:

GET https://login.domain-two.com/login?tid=hGZmFb77-9VyiwfkhIXIRMDp HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: de-DE
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Accept-Encoding: gzip, deflate
Host: login.domain-two.com
DNT: 1
Cookie: ...
Pragma: no-cache
Connection: Keep-Alive

响应:

HTTP/1.1 302 Found
Date: Tue, 13 Aug 2013 19:01:22 GMT
Server: Apache
P3P: CP="NOI CURa TAIa OUR NOR UNI"
Location: https://www.domain-one.de/BackFromLogin.aspx?TID=hGZmFb77-9VyiwfkhIXIRMDp
Content-Length: 277
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://dwww.domain-one.de/BackFromLogin.aspx?TID=hGZmFb77-9VyiwfkhIXIRMDp">here</a>.</p>
</body></html>

(3)到此为止,一切似乎都很正常。但是,IE10现在忽略刚刚收到的响应并再次遵循相同的重定向:

请求:

GET https://login.domain-two.com/login?tid=hGZmFb77-9VyiwfkhIXIRMDp HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: de-DE
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Accept-Encoding: gzip, deflate
Host: login.domain-two.com
DNT: 1
Connection: Keep-Alive
Cookie: ...

此服务器检测到此重复请求并拒绝它,并使用错误页面进行响应(我知道HTTP GET应该是幂等的,但这就是此站点的工作方式)。

为什么IE10会忽略原始响应并再次发出相同的请求(尽管没有&#39; Pragma:no-cache&#39;标头)。你有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我刚刚找到了解决方案(看到你的帖子后)。这里描述了http://support.microsoft.com/kb/2691205

就我而言,我正在打开一个包含iframe的对话框(使用jquery)。我没有将src放在iframe(例如)中,而是在对话框弹出窗口中添加了一些javascript

html = '<iframe id="myIframe">iframe not supported</iframe>';

$('#' + dialogId).append(html);
$('#' + dialogId).dialog({
title: 'SOME TITLE',
open: function () { $('#' + dialogId + 'iframe').attr('src', url); }  //IE10 HACK to     prevent double request!!!!

});