gpt4 book ai didi

internet-explorer - 当路径重叠时,Internet Explorer 发送错误的 cookie

转载 作者:行者123 更新时间:2023-12-02 22:50:00 24 4
gpt4 key购买 nike

我们有一个 Web 应用程序的多个副本,部署在同一域的多个路径上。
示例:

每个实例都维护一组 cookie,每个 cookie 将其路径定义为 "/"+ .getWebDirRoot() - 即 /abc/xyz/abc123

执行以下流程时:

最后一步失败,因为 IE 向我们发送了错误的 cookie - 它发送了 http://mydomain.com/abc 的 cookie。而不是 http://mydomain.com/abc123 的那个

这在 FireFox 中不会发生。 (我还没有尝试过任何其他浏览器)。

这是 IE 的已知行为(我测试了 IE9IE8)吗?
有没有办法克服它(以编程方式)?

注意:澄清一下,从 http://mydomain.com/abc 切换时不会发生这种情况。至 http://mydomain.com/xyz - 该行为严格限于 currentUrl.startswith(urlAssociatedWithCookie) == true

的流

我使用 Fiddler 检查了行为 - 我清楚地看到发送的 abc123 的 HTTP 请求带有属于 abc 的 cookie 值。

我还检查了 FireFox 上的 cookie,它们符合预期 - 每个路径创建一个。

最佳答案

经过一天多的调查并到处寻找有关 IE 行为的规范后,我一无所获 - 除了了解当 IE 看到来自域 xyz 的 cookie 时,我一无所获。 > 和路径 abc,它将在发送到以相同域和路径开头的任何 URL 的任何请求上发送它,例如`http://xyz/abc123'。

所以最终我所做的是改变我的 cookie 创建,而不是:

Name: mycookie
Path: /abc

我现在创建以下内容:

Name: mycookie
Path: /abc/

这解决了没有跳弹的问题 - cookie 成功保存在客户端上,并且始终将正确的 cookie 发送到服务器。

<小时/>

注意:我检查了 RFC for HTTP Cookies并发现了这个:

A request-path path-matches a given cookie-path if at least one of
the following conditions holds:

o The cookie-path and the request-path are identical.

o The cookie-path is a prefix of the request-path, and the lastcharacter of the cookie-path is %x2F ("/").

o The cookie-path is a prefix of the request-path, and the firstcharacter of the request-path that is not included in the cookie-path is a %x2F ("/") character.

这里应该应用的场景是第三个,但看起来 IE 不符合这种情况下的 RFC ...

关于internet-explorer - 当路径重叠时,Internet Explorer 发送错误的 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8292449/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com