【问题标题】:IE11 - LOSING MY COOKIES: 302 redirect from HTTP to HTTPSIE11 - 丢失我的 COOKIES:302 从 HTTP 重定向到 HTTPS
【发布时间】:2017-03-16 00:19:59
【问题描述】:

我正在使用 IE11 向站点 A 发出获取请求:

GET http://www.test.com/?documentId=ef746317-7711-4458-8873-a73700fc1b85 HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729)
Connection: Keep-Alive
Host: www.test.com

我收到带有 2 个 cookie 的重定向:

HTTP/1.1 302 Found
Date: Wed, 15 Mar 2017 23:48:00 GMT
Content-Type: text/html; charset=UTF-8
Location: https://www.newSite.com/test/Edit/ef746317-7711-4458-8873-a73700fc1b85
Set-Cookie: Auth=EAAAAIQfMoK32BNjBypXapcJppWc==; path=/; secure
Set-Cookie: Auth=EAAAAN+xPT6eioV8LESTR6CViGIvc834gP==; path=/; secure
Cache-Control: private, s-maxage=0
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 4.0
X-Powered-By: ASP.NET
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
P3P: policyref="/w3c/p3p.xml", CP="IDC DSP COR IVAi IVDi OUR TST"
Content-Length: 0

IE 似乎会遵循重定向并执行 GET,但正如您所见,它并未发回 cookie:

GET https://www.newSite.com/test/Edit/ef746317-7711-4458-8873-a73700fc1b85 HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729)
Connection: Keep-Alive
Host: www.newSite.com

然后当然是401:

HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Wed, 15 Mar 2017 23:48:00 GMT
Content-Length: 1293
<HTML>Blah blah blah access denied error</HTML>

我尝试添加 P3P 标头以强制 IE 在重定向中发送 cookie,但没有骰子。我已经读过,从 HTTP 到 HTTPS 时,IE 在重定向中发送 cookie 可能存在问题,或者因为“安全”cookie 被发送回 HTTP 上的浏览​​器,当重定向到 HTTP 时会看到不同的域并阻塞。我无法更改网站,因为它们是供应商,但我可以使用我正在开发的接口中间件更改发送回 IE11 的 302。关于如何欺骗/强制 IE 在重定向时发回这些 cookie 的任何想法?

更新 1:我尝试过 Firefox 52、IE11 和 Chrome。没有浏览器接受 302 并使用 cookie 发送返回。有人必须了解使用 cookie 进行重定向的工作原理。没有回复让我怀疑这个网站是否覆盖了合适的人。

【问题讨论】:

    标签: redirect cookies https internet-explorer-11


    【解决方案1】:

    我通过某种 hack 解决了我的问题。由于浏览器不会在 302 重定向中将 cookie 转发回,所以我只发回一个为我进行发布的小页面,而不是我的界面软件。

    <!DOCTYPE html>
    <html>
    <head>
    <title>Redirect</title>
    </head>
    <body>
    <form action="https://testAPI.test.com/" method="POST">
    <input name="UserName" value="Test APIUser"/>
    <input name="UserEmail" value="test@test.com"/>
    <input name="PatientId" value="1d11eb2e-2606-485e-ad5d-a70c00daa37a"/>
    <input name="Timestamp" value="Mon, 20 Mar 2017 19:11:24 GMT"/>
    84c6-a7210111648b"/>
    <input name="Token" value="MRVp/pBRBJ08F8cYMavfL8 ="/>
    </form>
    <script language="javascript"> window.setTimeout('document.forms[0].submit()', 0);</script>
    </body>
    </html>
    

    【讨论】:

      【解决方案2】:

      您可以禁用保护模式。保护模式旨在防止恶意软件利用 Internet Explorer 11 中的漏洞。此模式还可能会根据当前设置阻止 cookie。

      打开 Internet Explorer 11。 单击工具,然后选择 Internet 选项。 转到安全选项卡。 在此区域的安全级别下,清除启用保护模式复选框(需要重新启动 Internet Explorer)。 单击确定。 关闭 Internet Explorer 11,然后重新启动。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-08-16
        • 2018-11-07
        • 2019-01-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-09-10
        • 2017-10-06
        相关资源
        最近更新 更多