301 重定向是否始终保留引荐来源网址?

发布于 2024-08-04 10:04:47 字数 905 浏览 2 评论 0原文

我想知道 301 重定向是否始终保留引荐来源网址。

我创建了一个名为“gotoorig_https.html”的页面,其中包含指向页面“orig_https.asp”的超链接。
“orig_https.asp”将 301 重定向到“dest.html”,其中显示 document.referrer。

在本例中,

http page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  
https page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  

我还创建了一个名为“gotoorig_http.html”的页面,其中包含指向页面“orig_http.asp”的超链接。 “orig_http.asp”将 301 重定向到显示 document.referrer 的“dest.html”。

既然如此,

http page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer preserves  
https page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer DOES NOT preserve.

为什么会出现最后一种情况呢?

I want to know whether 301 redirect always preserve referrer.

I make a page called "gotoorig_https.html" which contains a hyperlink to a page "orig_https.asp".
"orig_https.asp" will 301 redirect to "dest.html" which shows the document.referrer.

In this case,

http page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  
https page(gotoorig_https.html) -> orig_https.asp(301 redirect)-> https page (dest.html) <--the referrer preserves  

I also make a page called "gotoorig_http.html" which contains a hyperlink to a page "orig_http.asp".
"orig_http.asp" will 301 redirect to "dest.html" which shows the document.referrer.

In this case,

http page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer preserves  
https page(gotoorig_http.html) -> orig_http.asp(301 redirect)-> http page (dest.html) <--the referrer DOES NOT preserve.

Why does the last case happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

末蓝 2024-08-11 10:04:47

RFC 未在状态 301 定义中指定任何特定于引用者的行为,也未在 Referer 标头定义中指定任何特定于 301 的行为。因此,我不得不说,虽然这种引用者保留行为是合乎逻辑的,但它并未在 RFC 中定义,因此您永远无法确定。

RFC doesn't specify any referrer-specific behavior in status 301 definition, nor 301-specific behavior in Referer header definition. Thus, I have to say that although this referrer-preserving behavior is logical, it is not defined in RFC and thus you can never be sure.

青衫儰鉨ミ守葔 2024-08-11 10:04:47

在 HTTP 和 HTTPS 之间切换时,HTTP 规范规定不应发送引用标头(请参阅 RFC2616)。然而,该规范并没有说明 HTTPS 页面之间应该发生什么。

有趣的是,在这种情况下,firefox 默认忽略规范,但可以通过设置 network.http.sendSecureXSiteReferrer 配置设置来使其符合规范。

When going between HTTP and HTTPS the HTTP spec says that a referer header should NOT be sent (see 15.1.3 in RFC2616). The spec doesn't say what should happen between HTTPS pages however.

Interestingly firefox defaults to ignoring the spec in this case, but can be made to conform by setting the network.http.sendSecureXSiteReferrer configuration setting.

本宫微胖 2024-08-11 10:04:47

通过 https,浏览器不会发送 REFERRERS。这是 RFC 中的内容。

Over https the browsers are not sending REFERRERS. This is in the RFC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文