网工干货知识

超全学习笔记
当前位置:首页 > 干货知识

HTTP头部信息 | 引用策略

更新时间:2026年03月27日   作者:spoto   标签(Tag):

那个引用策略/来源信息HTTP头部在发送请求时,会同时携带“Referrer Header”这一参数。Referrer Header的作用在于维护源账户的安全性和隐私性,从而确保在获取资源或进行导航操作时不会泄露相关信息。这一点是通过修改用于填充Referrer Header的算法来实现的。
引用策略/来源信息可以根据请求的方式以多种方式来传递它。这可以通过使用HTTP头或HTML中的meta元素来实现,其中referrer关键字被用作值。这样,就可以通过标记来设置referrer策略,或者使用referrerpolicy内容属性来实现这一目的。HTML. CSS当使用样式属性时,会参考所有者文档中的引用策略。不过,该策略可以被外部因素所覆盖或修改。样式表这些选项的默认值为“no-referrer-when-downgrade”。
语法: 

Referrer-Policy : no-referrerReferrer-Policy : no-referrer-when-downgradeReferrer-Policy : originReferrer-Policy : strict-originReferrer-Policy : origin-when-cross-originReferrer-Policy : strict-origin-when-cross-originReferrer-Policy : same-originReferrer-Policy : unsafe-url

指示/命令:这个头部可以接受上述提到的八种指令,具体说明如下:

  • 无引用限制:这并不会在请求中附带任何引用信息。
  • 无重定向机制:当发生降级时,不会进行重定向。这会将完整的URL信息发送给某个可能可靠的URL。该URL可以是基于现代HTTPS协议的,也可以不是基于现代协议的。HTTPS无论来自哪个地方,信息都会被发送出去。HTTPS -> HTTPS以及HTTP -> HTTPS过渡。这是默认的Referrer-Policy设置。
  • 来源:它仅在发起同源请求或跨源请求时,才会发送请求的原始值。
  • 严格来源:这只会将原始信息发送给那些可能值得信赖的网址。这是现代技术所实现的一种方式。HTTPS是否处于现代状态/否HTTPS无论来自哪个地方,都适用这一规则。
  • 来源-跨源时:在发起同源请求时,它会发送完整的URL信息;而在发起跨源请求时,则只发送源信息而已。
  • 严格同源时跨域:在处理来自同一源的请求时,它会发送完整的URL信息。而对于那些可能值得信赖的URL,它则只发送源信息而已。HTTPS是或不是现代的HTTPS该链接来自任何来源。不会向那些可能不可信的网址发送任何引用信息。
  • 相同来源:当源地址位于同一网站时,该请求会发送相关引用信息;而当源地址属于不同的网站时,则不会发送任何信息。
  • 不安全网址:它会发送完整的URL信息,而不考虑任何相关标准或条件。


例如:这是万维网联盟所给出的标准示例。这里的例子将请求被发送到的网站称为“导航网站”,同时还会附上相关的引用信息。为了便于理解,……https://example.com/page.html每个示例的“来源网站”将会被考虑在内。

  • 无重定向
Navigation website : http://survey-smiles.com/ (or any other website)Referrer : no referrer sent
  • 降级时避免重定向到其他页面
Navigation website : https://not.example.com/ Referrer : https://example.com/page.html-------------------------------------------Navigation Website : http://not.example.com/Referrer : no referrer sent
  • 起源
Navigation Website : any trustworthy or non-trustworthy URLReferrer : https://example.com/
  • 严格起源
Navigation Website : https://not.example.comReferrer : https://example.com/---------------------------------------------Navigation Website : http://not.example.comReferrer : no-referrer ---------------------------------------------Origin Website : http://example.com/page.htmlNavigation Website : any trustworthy or non-trustworthy URLReferrer : http://example.com/
  • 跨源时的起源
Navigation Website : https://example.com/not-page.html Referrer : https://example.com/page.html-------------------------------------------------------Navigation Website : https://not.example.com/ (or a non-trustworthy URL)Referrer : https://example.com/
  • 严格同源时跨域处理
Navigation Website : https://example.com/not-page.htmlReferrer : https://example.com/page.html.-------------------------------------------------------Navigation Website : https://not.example.com/Referrer : https://example.com/--------------------------------------------------------Navigation Website : http://not.example.com/Referrer : no referrer
  • 相同来源
Navigation Website : https://example.com/not-page.html Referrer : https://example.com/page.html------------------------------------------------------Navigation Website : https://not.example.com/Referrer : no referrer
  • 不安全链接
Navigation Website : Any trustworthy or non-trustworthy URLReferrer : https://example.com/page.html

支持的浏览器:所支持的浏览器包括:HTTP头部信息中的Referrer-Policy字段以下列出了这些内容。

  1. 谷歌浏览器
  2. Safari
  3. 微软Edge浏览器
  4. 歌剧
  5. Mozilla Firefox
              马上抢免费试听资格
意向课程:*必选
姓名:*必填
联系方式:*必填
QQ:
思博SPOTO在线咨询

相关资讯

即刻预约

免费试听-咨询课程-获取免费资料