首页
随机
最近更改
特殊页面
社群首页
参数设置
关于WHY42
免责声明
WHY42
搜索
用户菜单
登录
欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。
查看“︁HTTP Referer”︁的源代码
←
HTTP Referer
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
The Referer HTTP request header contains the absolute or partial address from which a resource has been requested. The Referer header allows a server to identify referring pages that people are visiting from or where requested resources are being used. This data can be used for analytics, logging, optimized caching, and more<ref>https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer</ref>. <syntaxhighlight lang="HTTP"> Referer: https://developer.mozilla.org/en-US/docs/Web/JavaScript Referer: https://example.com/page?q=123 Referer: https://example.com/ </syntaxhighlight> 主要是以下三种场景,会发送Referer字段<ref>https://www.ruanyifeng.com/blog/2019/06/http-referer.html</ref>。 * 用户点击网页上的链接。 * 用户发送表单。 * 网页加载静态资源,比如加载图片、脚本、样式。 == Referrer Policy == The original header name Referer is a misspelling of the word "'''referrer'''". The Referrer-Policy header does not share this misspelling. <syntaxhighlight lang="HTTP"> Referrer-Policy: no-referrer Referrer-Policy: no-referrer-when-downgrade Referrer-Policy: origin Referrer-Policy: origin-when-cross-origin Referrer-Policy: same-origin Referrer-Policy: strict-origin Referrer-Policy: strict-origin-when-cross-origin Referrer-Policy: unsafe-url </syntaxhighlight> Also, it's possible to set it in HTML,eg: <syntaxhighlight lang="bash"> <meta name="referrer" content="origin" /> <a href="http://example.com" referrerpolicy="origin">…</a> <a href="http://example.com" rel="noreferrer">…</a> </syntaxhighlight> == Exit Page Redirect == The only method that should work at the moment without flaw is to have an exit page that you don’t mind having inside of the referer header. Many websites implement this method, including Google and Facebook. Instead of having the referrer data show private information, it only shows the website that the user came from, if implemented correctly. Instead of the referrer data appearing as http://example.com/user/foobar the new referrer data will appear as http://example.com/exit?url=http%3A%2F%2Fexample.com <ref>https://geekthis.net/post/hide-http-referer-headers/#exit-page-redirect</ref>. <syntaxhighlight lang="html"> <a href="/exit.php?url=http%3A%2F%2Fexample.com">Example.com</a> </syntaxhighlight> == Referer and HTTPS == [[Category:Network]] [[Category:HTTP]] [[Category:RFC]] [[Category:Protocol]]
返回
HTTP Referer
。