How to Set the Referrer-Policy Header

Referrer-Policy controls how much of your page URL is shared with other sites when users click links. This guide shows how to set it on all major web servers and platforms.

Covers
Referrer-Policy, Privacy, Headers

The Referrer-Policy header controls how much URL information the browser includes in the Referer header when users navigate away from your pages. Without it, sensitive URL paths — including query strings with user IDs or session tokens — can leak to third-party sites. This guide shows how to set the header across all major web servers and platforms.

Choosing a Policy Value

ValueWhat Is SentBest For
no-referrerNothing — Referer header is omitted entirelyMaximum privacy; breaks referrer-based analytics
no-referrer-when-downgradeFull URL on HTTPS→HTTPS; nothing on HTTPS→HTTPLegacy default; not recommended (leaks paths to same-scheme third parties)
strict-origin-when-cross-originFull URL on same-origin; origin only on cross-origin HTTPS; nothing on HTTPRecommended for most sites — good balance of privacy and analytics
strict-originOrigin only on HTTPS; nothing on HTTP downgradesSites that need to minimise referrer data to third parties
same-originFull URL on same-origin only; nothing cross-originSites that want no referrer data sent to any third party
originOrigin only, alwaysSites needing referrer data but not full paths
unsafe-urlFull URL always, including to HTTP sitesAvoid — leaks sensitive paths even on downgrades
Recommended Valuestrict-origin-when-cross-origin is the browser default since Chrome 85 and the recommended value for most sites. Setting it explicitly ensures consistent behaviour across all browsers and documents your intent for security auditors.

Set the Header on Your Server

Nginx

nginx
server { listen 443 ssl; server_name example.com; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # ... rest of config }
bash
sudo nginx -t && sudo systemctl reload nginx

Setting via HTML Meta Tag

You can also set a per-page referrer policy using an HTML <meta> tag in the <head>. This is useful for pages where you need a different policy than the server-wide default:

html
<meta name="referrer" content="strict-origin-when-cross-origin">

The HTTP header takes precedence over the meta tag when both are present.

Verifying the Header

bash
curl -I https://example.com | grep -i referrer # Expected: referrer-policy: strict-origin-when-cross-origin

Or use the ShowDNS Security Headers Scanner.