Glossary / Referrer-Policy
Referrer-Policy
Referrer-Policy is an HTTP response header that controls how much information about the current page the browser puts in the Referer header when the user follows a link or the page loads a resource. With it you can keep full URLs with private parameters from reaching third-party sites.
Check your site
When a user clicks a link or the page loads an external resource, the browser adds a Referer header naming the page the request came from. Current browsers send other sites only the origin by default, but a looser policy, or an older browser, passes the full URL with tokens, IDs or search queries you would rather not hand to someone else's server.
Referrer-Policy sets how much of that address the browser trims. no-referrer drops the header entirely. strict-origin sends only the domain, without the path. The widely used strict-origin-when-cross-origin sends the full URL to your own pages, only the domain to other sites, and nothing when a request goes from HTTPS to HTTP.
The setting affects privacy and analytics at once. A policy that is too strict removes traffic-source data from your own stats, and one that is too open leaks addresses to third parties. strict-origin-when-cross-origin is a sensible default between the two, and it is what current browsers use when a site sets nothing.
Example
Referrer-Policy: strict-origin-when-cross-origin
Common mistakes
- Setting no-referrer for privacy and then losing referral sources in your own analytics, which also rely on Referer.
- Confusing Referer, the request header the browser sends, with Referrer-Policy, the response header that controls it.
- Trusting Referer for authorization. It is trivial to forge or strip, so it provides no security.
- Setting a loose policy such as unsafe-url and leaking full URLs with private parameters to other domains.