HTTP referer
The HTTP referer (a misspelling of referrer[1]) is an optional HTTP header field that identifies the address of the webpage (i.e., the URI or IRI) which is linked to the resource being requested. By checking the referrer, the new webpage can see where the request originated.
HTTP |
---|
Request methods |
Header fields |
Status codes |
Security access control methods |
Security vulnerabilities |
In the most common situation this means that when a user clicks a hyperlink in a web browser, the browser sends a request to the server holding the destination webpage. The request may include the referer field, which indicates the last page the user was on (the one where they clicked the link).
Referer logging is used to allow websites and web servers to identify where people are visiting them from, for promotional or statistical purposes.[2]
The default behaviour of referer leaking puts websites at risk of privacy and security breaches.[3]
Etymology
The misspelling of referrer originated in the original proposal by computer scientist Phillip Hallam-Baker to incorporate the field into the HTTP specification.[4] The misspelling was set in stone by the time of its incorporation into the Request for Comments standards document RFC 1945; document co-author Roy Fielding has remarked that neither "referrer" nor the misspelling "referer" were recognized by the standard Unix spell checker of the period.[5] "Referer" has since become a widely used spelling in the industry when discussing HTTP referrers; usage of the misspelling is not universal, though, as the correct spelling "referrer" is used in some web specifications such as the Document Object Model.
Details
When visiting a web page, the referrer or referring page is the URL of the previous webpage from which a link was followed.
More generally, a referrer is the URL of a previous item which led to this request. The referrer for an image, for example, is generally the HTML page on which it is to be displayed. The referrer field is an optional part of the HTTP request sent by the web browser to the web server.[6]
Many websites log referrers as part of their attempt to track their users. Most web log analysis software can process this information. Because referrer information can violate privacy, some web browsers allow the user to disable the sending of referrer information.[7] Some proxy and firewall software will also filter out referrer information, to avoid leaking the location of non-public websites. This can, in turn, cause problems: some web servers block parts of their website to web browsers that do not send the right referrer information, in an attempt to prevent deep linking or unauthorised use of images (bandwidth theft). Some proxy software has the ability to give the top-level address of the target website as the referrer, which usually prevents these problems while still not divulging the user's last-visited website.
Many blogs publish referrer information in order to link back to people who are linking to them, and hence broaden the conversation. This has led, in turn, to the rise of referrer spam: the sending of fake referrer information in order to popularize the spammer's website.
It is possible to access the referrer information on the client side using document.referrer in JavaScript.[8] This can be used, for example, to individualize a web page based on a user's search engine query. However, the referrer field does not always include queries, such as when using Google Search with https.[9]
Referer hiding
Most web servers maintain logs of all traffic, and record the HTTP referrer sent by the web browser for each request. This raises a number of privacy concerns, and as a result, a number of systems to prevent web servers being sent the real referring URL have been developed. These systems work either by blanking the referrer field or by replacing it with inaccurate data. Generally, Internet-security suites blank the referrer data, while web-based servers replace it with a false URL, usually their own. This raises the problem of referrer spam. The technical details of both methods are fairly consistent – software applications act as a proxy server and manipulate the HTTP request, while web-based methods load websites within frames, causing the web browser to send a referrer URL of their website address. Some web browsers give their users the option to turn off referrer fields in the request header.[7]
Most web browsers do not send the referrer field when they are instructed to redirect using the "Refresh" field. This does not include some versions of Opera and many mobile web browsers. However, this method of redirection is discouraged by the World Wide Web Consortium (W3C).[10]
If a website is accessed from a HTTP Secure (HTTPS) connection and a link points to anywhere except another secure location, then the referrer field is not sent.[11]
The HTML5 standard added support for the attribute/value rel="noreferrer", which instructs the user agent to not send a referrer.[12]
Another referrer hiding method is to convert the original link URL to a Data URI scheme-based URL containing small HTML page with a meta refresh to the original URL. When the user is redirected from the data: page, the original referrer is hidden.
Content Security Policy standard version 1.1 introduced a new referrer directive that allows more control over the browser's behavior in regards to the referrer header. Specifically it allows the webmaster to instruct the browser not to block referrer at all, reveal it only when moving with the same origin etc.[13]
References
- "HTTP:The Definitive Guide".
- Kyrnin, Jennifer (2012-04-10). "Referrer - What is a Referrer - How do HTTP Referrers Work?". About.com. Retrieved 2013-03-20.
- "Does your website have a leak?". ICO Blog. 2015-09-16. Archived from the original on 2018-05-24. Retrieved 2018-08-16.
- Hallam-Baker, Phillip (2000-09-21). "Re: Is Al Gore The Father of the Internet?". alt.folklore.computers. Retrieved 2013-03-20.
- Fielding, Roy (1995-03-09). "Re: referer: (sic)". ietf-http-wg-old. Retrieved 2013-03-20.
- "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content (RFC 7231 § 5.5.2)". IETF. June 2014. Retrieved 2014-07-26.
The "referrer" [sic] header field allows the user agent to specify a URI reference for the resource from which the target URI was obtained […]
- "Network.http.sendRefererHeader". MozillaZine. 2007-06-10. Retrieved 2015-05-27.
- "HTML DOM Document referrer Property". w3schools.com. Retrieved 2013-03-20.
- Gundersen, Bret (2011-10-19). "The Impact of Google Encrypted Search". Adobe Digital Marketing Blog. Retrieved 2013-03-20.
- "HTML Techniques for Web Content Accessibility Guidelines 1.0: The META element". W3C. 2000-11-06. Retrieved 2013-03-20.
- "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content: referrer (RFC 7231 § 5.5.2)". IETF. June 2014. Retrieved 2014-07-26.
A user agent MUST NOT send a referrer header field in an unsecured HTTP request if the referring page was received with a secure protocol
- "4.12 Links — HTML Living Standard: 4.12.5.8 Link type "noreferrer"". WHATWG. 2016-02-19. Retrieved 2016-02-19.
- "Content Security Policy Level 2". W3. 2014. Retrieved 2014-12-08.
External links
Look up referer or referrer in Wiktionary, the free dictionary. |
- RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
- RFC 3987: Internationalized Resource Identifiers (IRIs)
- Referrer Policy - W3C Editor's Draft