This article describes a proposal for a metadata parameter for the referer in the HTTP protocol. Using this metadata parameter, an HTML document can control the referer in an HTTP request, such as whether to send a referer, only send a hostname, or send a complete referer. Although there are some ways to control the referer, such as flash, and some js tricks, this article describes another picture. Usage scenarios In some cases, for some reasons, the website wants to control the referer information sent to the server by the page, and can use this referer metadata parameter. privacy Social networking sites generally have user personal pages, in which users may add some external links. Social networking sites may not want to disclose the URLs of user pages when users click on these links, because these URLs may contain some sensitive information. Of course, some social networking sites may only want to provide a hostname in the referer, rather than the full URL information. Safety Some websites that use https may use a parameter (sid, etc.) in the URL as the user's identity credential, and need to introduce resources from other https websites. In this case, the website certainly does not want to leak the user's identity credential information. Object-Capability Discipline Some websites follow Object-Capability Discipline, and referer happens to be contrary to this strategy. Therefore, it will be beneficial to Object-Capability Discipline if the website can control referer. Technical Details The metedata parameter of referer can be set to the following types of values:
If a meta tag is inserted into a document and the value of the name attribute is referer, the browser client will process the tag as follows:
After the above steps, when the browser subsequently initiates an http request, it will respond as follows according to the value of content (the value of referer-policy below is the value of content in the meta tag): 1. If the value of referer-policy is never: delete the referer in the http head; example If the page contains the following meta tag, all requests initiated from the current page will not carry the referer:
If the page contains the following meta tag, the http request initiated from the current page will only carry the origin part (Note: According to the context in the original text, I understand that the origin here is the partial URL containing the schema and hostname, and does not include other URL parts such as path), rather than the complete URL:
Note: When using the meta tags described in this article, the browser's original referer strategy will be broken. For example, when jumping from an http page to an https page, if the appropriate value is set, the referer will also be carried. Other issues How does this relate to rel=noreferer? It is possible that rel=noreferer will override the value set by the meta tag in this article. That is functional coverage. Translator's Note This article was originally written in 2012. The original page is now abandoned and the w3c referer-policy page has been provided. However, the translator noticed that many websites currently use the referer verification method when defending against CSRF, and sometimes allow the referer to be empty. In addition, some important businesses of BAT manufacturers also use the referer verification method and allow the referer to be empty when defending against JSON hijacking. You may think that what is described in this article is just a proposal, but FireFox has stated in an article on the 21st that starting from Firefox 36 Beta, it will support referer-policy, which will undoubtedly threaten the business of some manufacturers. [Reference source wiki.whatwg.org, please indicate that it is from FreeBuf Hackers and Geeks (FreeBuf.COM)] https and http referer jump problem The Referer in the Http protocol header is mainly used for the server to determine the source page, that is, which page the user came from. Get method: $_SERVER['HTTP_REFERER'] In https->http redirection, it is not recommended to pass referral, but there is no such problem in https->https and http->https. For example, I get the QR code interface address: The right effect https://qrcode.artron.net/?text=https|http://m-exhibit.artron.net/&el=10&margin=1 The effect of error http://qrcode.artron.net/?text=https://m-exhibit.artron.net/jump/index The verification results show that https is compatible with some parameter issues of http, but http is not compatible with the parameter issues of https. Here is the difference between http and https. The Hypertext Transfer Protocol (HTTP) is used to transfer information between web browsers and website servers. The HTTP protocol sends content in plain text and does not provide any form of data encryption. If an attacker intercepts the transmission message between the web browser and the website server, the attacker can directly read the information in it. Therefore, the HTTP protocol is not suitable for transmitting some sensitive information, such as credit card numbers, passwords, etc. The main differences between HTTPS and HTTP are as follows: 1. The https protocol requires applying for a certificate from a CA. Generally, there are few free certificates and you need to pay for them. Here are the answers to the questions: According to the above description, in general, when redirecting from an HTTPS site to an HTTP site, the browser does not send a referrer by default. There are roughly two ways to let the browser send a referrer: 1. Add in the head of Station A
2. Station B also uses HTTPS Of course, if Station A has a mandatory rule not to send referrers, and Station B has no control over Station A, as mentioned above, we cannot control the third-party statistical tools to count the Baidu search source keywords. |
>>: Detailed tutorial on installing Docker on CentOS 8
When the user's home directory becomes larger...
Table of contents 1. What is Proxy? 2. How to use...
As a front-end Web engineer, you must have encoun...
Error scenario Use the mysql command in cmd to ad...
Table of contents Docker container data volume Us...
Docker daemon socket The Docker daemon can listen...
A MySQL custom value is a temporary container for...
*Create a page: two input boxes and a button *Cod...
If you use CSS don't forget to write DOCTYPE, ...
Table of contents 1. Concept 2. Environmental Des...
This article example shares the specific code of ...
I believe many programmers are familiar with MySQ...
Socket option function Function: Methods used to ...
Use MySQL proxies_priv (simulated role) to implem...
Preface With the crazy speculation of virtual cur...