Skip to main content

Referrer-Policy

SecurityActive

Referrer-Policy controls how much referrer information is included in the Referer request header when following links or loading resources. The default browser behavior sends the full URL as a referrer, which can leak sensitive path segments and query parameters to third parties.

Referrer-Policy: no-referrer | no-referrer-when-downgrade | origin | origin-when-cross-origin | same-origin | strict-origin | strict-origin-when-cross-origin | unsafe-url

Description

When a user navigates from one page to another, the browser sends the originating URL in the Referer header. Without a Referrer-Policy, this exposes full URLs including query parameters – leaking session tokens, user IDs, search terms, and other sensitive data to analytics scripts, CDNs, and linked sites. strict-origin-when-cross-origin is the recommended default: it sends the full URL for same-origin requests, only the origin for cross-origin requests, and nothing when navigating from HTTPS to HTTP. The no-referrer value suppresses the Referer header entirely. The policy can be set at the HTTP response header level, via <meta name="referrer"> in HTML, or per-link with the referrerpolicy attribute.

Directives

DirectiveDescription
no-referrerNever send a Referer header. Maximum privacy.
no-referrer-when-downgradeSend full URL to HTTPS origins; nothing to HTTP. Browser default before this header was standardized.
originSend only the origin (scheme + host + port), never the path or query.
origin-when-cross-originFull URL for same-origin requests; only origin for cross-origin.
same-originSend full URL for same-origin requests; nothing for cross-origin.
strict-originSend only origin for same-origin and HTTPS cross-origin; nothing for HTTP.
strict-origin-when-cross-originRecommended default. Full URL same-origin; origin cross-origin HTTPS; nothing cross-origin HTTP.
unsafe-urlAlways send full URL including path and query. Never use this – leaks sensitive URL parameters.

Examples

Recommended default
http
Referrer-Policy: strict-origin-when-cross-origin
Maximum privacy
http
Referrer-Policy: no-referrer
Internal analytics – full URL same-origin only
http
Referrer-Policy: same-origin
Per-link in HTML
http
<a href="https://external.example" referrerpolicy="no-referrer">Link</a>

Related

Specification

W3C RecommendationReferrer-Policy specification →