Referrer-Policy: controlling what the Referer header leaks
Referrer-Policy decides how much of the current URL is sent in the Referer header when a visitor follows a link or the page loads a resource from another site.
At a glance
- Direction
- Response header, and it can also be set per document or per link in markup.
- Defined in
- Referrer Policy (W3C)
- When absent
- Current Chrome, Firefox and Edge fall back to strict-origin-when-cross-origin on their own.
- Safest value
- no-referrer, at the cost of breaking referral attribution
- Common recommendation
- strict-origin-when-cross-origin
- Overridden by
- A referrerpolicy attribute on an individual link, image, script or iframe
- In the headers checker
- Graded. It warns when the value is unsafe-url.
In detail
The Referer header (misspelled in the original specification and never corrected) carries the URL of the page that triggered a request. That is useful for attribution and dangerous for privacy, because a password reset link, a document URL with an identifier in it, or a search results page all end up in the logs of whichever third party the page happens to load a script or an image from.
The values form a scale. no-referrer sends nothing. same-origin sends the full URL to your own origin and nothing to anyone else. origin sends only scheme, host and port everywhere. strict-origin sends the origin but drops it entirely when moving from HTTPS to HTTP. strict-origin-when-cross-origin, the modern default, sends the full URL within your origin and only the origin when leaving it.
The value to avoid is unsafe-url, which sends the full URL including the query string to every destination, plain HTTP ones included. no-referrer-when-downgrade is the old browser default and behaves the same way for HTTPS to HTTPS navigation, which is most of the web, so it also leaks full URLs to third parties.
Because modern browsers already default to strict-origin-when-cross-origin, setting the header is mainly about being explicit and about choosing something stricter. It is worth setting on responses whose URLs contain anything sensitive, and worth overriding per element with the referrerpolicy attribute when one outbound link needs different treatment from the rest of the page.
Examples
Referrer-Policy: strict-origin-when-cross-originReferrer-Policy: no-referrer, strict-origin-when-cross-originA browser takes the last value it understands, so older clients land on no-referrer and newer ones use the second token.
<a href="https://partner.example.com/report" referrerpolicy="no-referrer">Open report</a>Things that catch people out
- The request header is spelled Referer with one r, while the policy header is spelled Referrer with two. Searching logs for the wrong one finds nothing.
- Sensitive data in a URL leaks to every third party asset on the page, not only to links the user clicks. One image from another host is enough.
- Setting origin or no-referrer flattens referral reports in analytics, so agree the change with whoever reads those numbers first.
Try it: HTTP Headers Checker
Check a live URL or paste headers you already have. It grades six security headers from A+ to F and lists every other header the response returned.
HTTP Headers Checker
LOCAL · Browser-OnlyView HTTP response headers for any URL
Enter any website URL to fetch and analyze its HTTP response headers. We'll automatically add https:// if needed.
Why Check Security Headers?
Security headers protect your website against common attacks like XSS, clickjacking, and MIME sniffing. They're set by your web server and cost nothing to implement. Missing security headers are one of the most common findings in security audits.
Related HTTP headers
All http headers →Content-Security-Policy: directives, sources and reporting
How CSP directives are matched, what default-src actually falls back to, why unsafe-inline defeats the point of a policy, and how nonces and hashes work.
Timing-Allow-Origin: exposing detailed resource timings
Why cross-origin resources show zeroed timings, what Timing-Allow-Origin unlocks in the Resource Timing API, and how it differs from a CORS allow header.
Origin: where a request was initiated from
When browsers send Origin, why it is only scheme, host and port, when the value is null, and how to use it for cross-site request forgery defence.
Permissions-Policy: turning browser features off by default
How Permissions-Policy allowlists are written, the empty parentheses that disable a feature, and how the syntax differs from the Feature-Policy header.
X-XSS-Protection: a legacy header and why it is off
What the browser XSS auditor did, why Chrome and Edge removed it, why 0 is now the recommended value, and what to send in its place.
Cross-Origin-Opener-Policy: isolating your browsing context
What COOP severs between your page and the windows it opens, how same-origin differs from same-origin-allow-popups, and its part in cross-origin isolation.
Tools for this
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL
- SEO Analyzer Free online SEO analyzer - analyze any website's SEO score and get actionable improvement tips