我遇到了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会跟随这个重定向。服务器设置一些cookies并重定向回到原始站点:
请求:
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 会忽略原始响应并再次发起同样的请求(尽管没有 'Pragma: no-cache' 头部)。你有任何想法吗?