Referrer-Policy Generator
Control how much referrer data your site leaks to external destinations.
Referrer Policy
Control the referrer information sent with cross-origin requests.
Generated Snippets
Why use a Referrer-Policy?
Whenever a user clicks a link, makes an API request, or loads an image, the browser sends an HTTP Referer header (yes, it's misspelled in the spec) to the destination server. This header tells the receiving server exactly which URL the user just came from.
This can be a privacy concern. For example, if a user is on https://yoursite.com/password-reset?token=12345 and clicks an external link to Twitter, Twitter would receive the full URL, including the secret token, in the Referer header!
Best Practices
Modern browsers (Chrome, Firefox, Safari) now default to strict-origin-when-cross-origin if no policy is specified. This is a great baseline because it only sends the domain name (not the full path or query parameters) when linking to other sites.
You can explicitly set this via an HTTP header (Referrer-Policy: strict-origin-when-cross-origin) or an HTML meta tag (<meta name="referrer" content="strict-origin-when-cross-origin">) to ensure consistent behavior across all older and newer browsers.
Related Guides
Deepen your understanding with our expert articles.
