Wiki / Security headers

Warning: Referrer-Policyheader not set

The site does not say how much of its page address to reveal to other sites when a visitor follows a link. The risk is small: modern browsers pass only the domain to other sites even without the header.

What it does not mean. It does not mean addresses with parameters are leaking now. Since November 2020 the standard applies strict-origin-when-cross-origin when no policy is given. The header matters for older browsers and for behaviour that does not depend on the browser.

Aleksandr IzmalkovFacts checked:

In our report
Warning (yellow), category weight 1.0 of 2.0
Time to fix
5 minutes
Can it break things
Not with the default value. With no-referrer, analytics suffer

How to fix it

nginx (tested on 1.26.3)

add_header Referrer-Policy "strict-origin-when-cross-origin" always;

Apache (tested on 2.4.59, also works in .htaccess)

Header always set Referrer-Policy "strict-origin-when-cross-origin"

Without server access

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

Works from the page <head>. A single link can carry referrerpolicy="no-referrer".

How to check

curl -sI https://example.com | grep -i referrer-policy

Expected

referrer-policy: strict-origin-when-cross-origin
Terminal: a test nginx returns the Referrer-Policy header together with the other security headers
A test nginx 1.26.3 with four security headers: they are sent on both the 200 and the 404 response.

What can break

  • With no-referrer or same-origin, affiliate and advertising systems no longer see that the visitor came from you. If you earn commission that way, check before changing.
  • Some payment and sign-in systems check where a request came from. With no-referrer they may reject a returning visitor.

Possible values

ValueWhat it passes onWhen to choose it
strict-origin-when-cross-originFull address within your site; domain only to others; nothing from HTTPS to HTTPThe browser default; right for almost everyone
same-originNothing to other sitesWhen addresses carry sensitive data (order numbers, tokens)
no-referrerNothing to anyone, including yourselfThe strictest; internal navigation disappears from analytics
originDomain only, to everyoneRarely needed
unsafe-urlFull address to everyone, even from HTTPS to HTTPDo not use

Sources

Next