# HTTP 引用页

HTTP 引用页（HTTP referer）是一个可选的请求头，拼作 `Referer`，浏览器通过它告诉服务器当前请求是从哪个资源地址获得的，例如包含被点击链接的页面，或加载了某张图片的页面。服务器将它用于分析、日志记录、优化缓存以及查找过时或拼写错误的链接，有些服务器还用它来防范跨站请求伪造（CSRF）或拒绝所谓的深度链接，尽管并非每个请求都带有该头。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> 该头名称是单词“referrer”的拼写错误，这一错误从 1996 年 5 月的 HTTP/1.0 规范沿用至今，出于兼容性考虑被保留下来；后来的 `Referrer-Policy` 头以及 [JavaScript](https://www.edgepedia.org/zh/javascript) 和 DOM 中的术语 `referrer` 则拼写正确。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup><sup> • </sup><sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup>

| 关键事实 | 详情 |
|---|---|
| 头名称 | `Referer`（原文如此），系“referrer”的拼写错误，从 1996 年 5 月的 HTTP/1.0 规范沿用而来<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup><sup> • </sup><sup>[3](https://datatracker.ietf.org/doc/html/rfc1945.txt)</sup> |
| 值 | 引用资源的绝对或部分 URI；不得包含片段（`#section`）和 `username:password` 用户信息<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup><sup> • </sup><sup>[4](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer)</sup> |
| 强制省略 | 如果引用资源是通过安全协议访问的，用户代理不得在非安全 HTTP 请求中发送 `Referer`<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> |
| 无源 URI | 如果目标 URI 来自没有自身 URI 的来源，例如键盘输入或书签，用户代理必须省略 `Referer` 或发送 `about:blank`<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> |
| 控制策略 | `Referrer-Policy` 响应头、`<meta>` 元素、`referrerpolicy` 属性或 `Request.referrerPolicy` 决定发送多少 URL 信息<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup><sup> • </sup><sup>[5](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Referrer_policy)</sup> |
| 当前默认值 | `strict-origin-when-cross-origin`：同源请求发送完整 URL，跨源请求仅发送源，HTTPS 到 HTTP 不发送任何信息<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup> |
| 默认值采用 | Chrome 从版本 85 起将默认值切换为 `strict-origin-when-cross-origin`；Firefox 87 于 2021 年 3 月跟进<sup>[6](https://developer.chrome.com/blog/referrer-policy-new-chrome-default/?authuser=0)</sup><sup> • </sup><sup>[7](https://blog.mozilla.org/security/2021/03/22/firefox-87-trims-http-referrers-by-default-to-protect-user-privacy/)</sup> |

## 目的与内容

当用户点击链接时，`Referer` 头包含包含该链接的页面地址；当页面从另一个域加载资源时，它包含请求该资源的页面地址。<sup>[4](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer)</sup> 该值可以包含引用页面的源、路径和查询字符串，但绝不包含 URL 片段或 `username:password` 用户信息，用户代理必须将其剥离。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup><sup> • </sup><sup>[4](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer)</sup> 字段值是绝对 URI，或是相对于目标 URI 解释的部分 URI。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup>

该头在实践中是可选的。大多数通用用户代理在引用资源是本地 `file` 或 `data` URI 时不发送它，而目标 URI 来自键盘或书签的请求要么不带 `Referer`，要么值为 `about:blank`。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> 规范还允许用户代理将值截断为仅引用源。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup>

## 隐私与安全规则

由于该头可能泄露用户的浏览上下文，HTTP 规范施加了限制。当引用资源通过安全协议访问而请求目标具有不同源时，用户代理不应发送 `Referer`，除非引用资源明确允许；如果引用资源是通过安全方式访问的，则绝不能在非安全 HTTP 请求中发送 `Referer`。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> 这种担忧是具体的：引用 URL 可能包含账户名，或标识某个本应保密的资源，例如防火墙后的资源。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup>

一些中间设备会不加区分地从传出请求中删除 `Referer` 字段。规范指出，这会干扰 CSRF 防护，可能对用户造成伤害，并建议希望限制信息披露的中间设备改为做具体修改，例如用假名替换内部域名，或截断路径和查询字符串。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup>

## Referrer-Policy

由 W3C Web 应用安全工作组标准化的 `Referrer-Policy` 响应头，让站点可以精细控制浏览器发送多少引用信息。<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup><sup> • </sup><sup>[8](https://www.w3.org/TR/referrer-policy/)</sup> 其指令包括：<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup>

- `no-referrer`：完全省略 `Referer` 头。
- `no-referrer-when-downgrade`：当协议安全级别保持不变或提高时（HTTP→HTTP、HTTP→HTTPS、HTTPS→HTTPS）发送完整 URL；对于安全性更低的目标（如 HTTPS→HTTP）不发送任何信息。
- `origin`：仅发送源，例如 `https://example.com/`。
- `origin-when-cross-origin`：同源请求发送完整 URL，跨源请求和安全性更低的目标仅发送源。
- `same-origin`：同源请求发送完整 URL，跨源请求不发送任何信息。
- `strict-origin`：安全级别不变时仅发送源；对安全性更低的目标不发送任何信息。
- `strict-origin-when-cross-origin`：同源请求发送完整 URL，同安全级别的跨源请求仅发送源，对安全性更低的目标不发送任何信息。
- `unsafe-url`：无论安全性如何，任何请求都发送源、路径和查询字符串，此设置可能将 HTTPS URL 中潜在的私密信息泄露给不安全的源。

自 2020 年 11 月的规范修订以来，当未指定策略或提供的值无效时，`strict-origin-when-cross-origin` 是默认策略；此前的默认值是 `no-referrer-when-downgrade`。<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup> Chrome 从版本 85 起采用此默认值，作为其隐私沙盒工作中减少静默跨站跟踪的一部分，Firefox 87 于 2021 年 3 月对导航、重定向和子资源请求应用了相同默认值。<sup>[6](https://developer.chrome.com/blog/referrer-policy-new-chrome-default/?authuser=0)</sup><sup> • </sup><sup>[7](https://blog.mozilla.org/security/2021/03/22/firefox-87-trims-http-referrers-by-default-to-protect-user-privacy/)</sup> WebKit 为 Safari 跟踪了同样的规范变更。<sup>[9](https://bugs.webkit.org/show_bug.cgi?id=218909)</sup>

策略可以通过多种方式传递：作为 HTTP 响应头，作为放在文档头部最前面的 `<meta http-equiv="Referrer-Policy">` 元素，通过单个元素（如链接）上的 `referrerpolicy` HTML 属性，或通过 fetch 请求上的 `Request.referrerPolicy` 属性。属性形式不接受多个值。<sup>[5](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Referrer_policy)</sup> 当多个来源指定策略时，最后处理的一个生效，未知值被忽略，这使站点可以首先列出一个回退值，其次列出一个较新的策略；旧浏览器使用回退值，而较新的浏览器使用最后一个值。<sup>[8](https://www.w3.org/TR/referrer-policy/)</sup>

**浏览器加固。** 在近期版本的 Firefox 和 Safari 中，宽松指令 `no-referrer-when-downgrade`、`origin-when-cross-origin` 和 `unsafe-url` 无论站点请求什么，都表现得像 `strict-origin-when-cross-origin`。<sup>[5](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Referrer_policy)</sup> Firefox 还暴露了用户偏好设置，例如版本 59 及以后的 `network.http.referer.defaultPolicy`，可以独立于站点策略更改浏览器范围的默认值。<sup>[2](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)</sup> W3C 规范明确允许用户代理提供完全抑制引用信息的控制选项，无论页面策略如何规定。<sup>[8](https://www.w3.org/TR/referrer-policy/)</sup>

## 安全用途

该头在 Web 安全中扮演双重角色。一些服务器检查 `Referer` 值以防范跨站请求伪造，即恶意站点诱骗已认证用户的浏览器向受信任站点发出请求的攻击。2008 年，斯坦福大学的亚当·巴思（Adam Barth）、科林·杰克逊（Collin Jackson）和约翰·C·米切尔（John C. Mitchell）基于 283,945 次广告展示进行的一项研究发现，由于隐私担忧，该头在网络层被广泛屏蔽，但结论是它可以在 HTTPS 上作为可靠的 CSRF 防御手段，特别是针对登录 CSRF；同一篇论文提出了 `Origin` 头作为长期替代方案。<sup>[10](https://seclab.stanford.edu/websec/csrf/)</sup> `Origin` 头在 Fetch 标准中定义为不暴露路径的 `Referer` 版本，现在用于 CORS 获取以及方法既非 GET 也非 HEAD 的请求。<sup>[11](https://fetch.spec.whatwg.org/)</sup>

当前的 OWASP 指南将源或引用页验证视为纵深防御措施而非主要控制手段：在跨源重定向产生 `Origin: null`、沙箱化不透明源以及负载均衡器或代理剥离该头的网络等合法情况下，该头会缺失，因此头缺失并不能证明请求是同源的，站点应提供明确的回退方案，例如服务器验证的 CSRF 令牌。<sup>[12](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)</sup> HTTP 规范本身对剥离该字段的中间设备也提出了同样的观点。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup>

## 历史

该头首次出现在 RFC 1945，即 1996 年 5 月发布的 HTTP/1.0 规范中，该规范已经描述了其用途：生成反向链接、日志记录、优化缓存以及追踪过时或拼写错误的链接，并且已经要求在请求 URI 来自没有自身 URI 的来源（如键盘输入）时省略它。<sup>[3](https://datatracker.ietf.org/doc/html/rfc1945.txt)</sup> 1999 年 6 月的 HTTP/1.1 规范 RFC 2616 增加了一条建议：当引用页面通过安全协议传输时，客户端不应在非安全 HTTP 请求中包含 `Referer`。<sup>[13](https://www.rfc-editor.org/rfc/pdfrfc/rfc2616.txt.pdf)</sup> RFC 9110（2022 年 6 月）中的当前定义将其强化为禁止，并正式确定了截断和用户信息规则。<sup>[1](https://www.rfc-editor.org/rfc/rfc9110.html)</sup> 引用策略控制最初由亚当·巴思和约亨·艾辛格（Jochen Eisinger）在 WHATWG 的 `<meta>` 提案中勾勒，后来成为 W3C 引用策略规范，浏览器对 `Referrer-Policy` 头的支持在 2016 年至 2020 年间广泛落地。<sup>[8](https://www.w3.org/TR/referrer-policy/)</sup><sup> • </sup><sup>[7](https://blog.mozilla.org/security/2021/03/22/firefox-87-trims-http-referrers-by-default-to-protect-user-privacy/)</sup>

## References

1. [RFC 9110: HTTP Semantics, Section 10.1.3 Referer, RFC Editor (June 2022)](https://www.rfc-editor.org/rfc/rfc9110.html)
2. [Referrer-Policy header, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)
3. [RFC 1945: Hypertext Transfer Protocol -- HTTP/1.0, Section 10.13 Referer, RFC Editor (May 1996)](https://datatracker.ietf.org/doc/html/rfc1945.txt)
4. [Referer header, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer)
5. [Referrer policy configuration, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Referrer_policy)
6. [A new default Referrer-Policy for Chrome: strict-origin-when-cross-origin, Chrome for Developers](https://developer.chrome.com/blog/referrer-policy-new-chrome-default/?authuser=0)
7. [Firefox 87 trims HTTP Referrers by default to protect user privacy, Mozilla Security Blog (March 2021)](https://blog.mozilla.org/security/2021/03/22/firefox-87-trims-http-referrers-by-default-to-protect-user-privacy/)
8. [Referrer Policy, W3C Recommendation-track specification](https://www.w3.org/TR/referrer-policy/)
9. [WebKit bug 218909: Change default referrer policy to strict-origin-when-cross-origin](https://bugs.webkit.org/show_bug.cgi?id=218909)
10. [Barth, Jackson, Mitchell: Robust Defenses for Cross-Site Request Forgery, Stanford Security Lab (CCS 2008)](https://seclab.stanford.edu/websec/csrf/)
11. [Fetch Standard, WHATWG, Section 3.2 Origin header](https://fetch.spec.whatwg.org/)
12. [Cross-Site Request Forgery Prevention Cheat Sheet, OWASP](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)
13. [RFC 2616: HTTP/1.1, Section 15.1.3, RFC Editor (June 1999)](https://www.rfc-editor.org/rfc/pdfrfc/rfc2616.txt.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › HTTP and web communication protocols

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/http-referer

English original: https://www.edgepedia.org/http-referer
