❤️
SecurityHeaders.nl

Referrer-Policy

The Referrer-Policy HTTP header controls how much referrer information (sent via the Referer header) should be included with requests made to external sites.

Why Referrer-Policy Matters

When a user clicks a link on your website that points to an external domain, the browser automatically sends a Referer header to the destination server, revealing the exact URL the user came from.

This can be a security and privacy risk if your URLs contain sensitive information, such as session tokens, password reset links, or private user data (e.g., https://example.com/reset-password?token=123xyz). If a user clicks an external link from that page, the external site would receive the token.

Recommended Directives

Referrer-Policy: strict-origin-when-cross-origin

This is the modern default for most web browsers. It sends the full URL when making same-origin requests, but only sends the origin (e.g., https://example.com/) when making cross-origin requests, provided the destination is also secure (HTTPS). If downgrading to HTTP, no referrer is sent.

Referrer-Policy: no-referrer

The most secure, privacy-preserving setting. The Referer header will be omitted entirely. No referrer information is sent along with requests.

Referrer-Policy: same-origin

Referrer information is sent for same-origin requests, but cross-origin requests contain no referrer information.

Setting the Policy

While browsers are increasingly adopting strict-origin-when-cross-origin as the default behavior, explicitly setting the Referrer-Policy header ensures your site's privacy requirements are enforced consistently across all browsers.