How to check referrer-policy header

Read the response header of the document: curl -sI https://example.org/ | grep -i referrer-policy. The value names how much of the current URL the browser attaches to outgoing requests. No header at all is still a policy, because Chrome, Firefox and Safari fall back to strict-origin-when-cross-origin.

Why check this

The Referer request header carries the address of the page the user came from. If that address holds a password reset token, an invitation code, a document id or an email address, every third-party script, image and outbound link on the page receives it. A policy of unsafe-url on a reset page hands the token to an analytics vendor in plain text.

Run this check on the pages whose URLs contain secrets, not on the homepage: reset links, magic links, shared document views, anything under a signed URL. Run it again after a marketing tag, a chat widget or an error tracker is added, since those load from other origins and are exactly what the policy governs.

Prerequisites

Steps

  1. Step 1.

    Read the header on the document response.

    curl -sI https://www.cloudflare.com/ | grep -i 'referrer-policy'
    
    referrer-policy: strict-origin-when-cross-origin

    Same origin requests get the full URL. Cross origin requests get the scheme, host and port only. A downgrade from HTTPS to HTTP gets nothing.

  2. Step 2.

    Count the header on a host that does not send it, so a missing policy is a number you can assert on.

    curl -sI https://example.com/ | grep -ci 'referrer-policy'
    
    0
  3. Step 3.

    Read a host that sends two policies in one header and work out which one applies.

    curl -sI https://api.github.com/ | grep -i 'referrer-policy'
    
    referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin

    The browser walks the list left to right and keeps the last token it recognises, so a modern browser applies strict-origin-when-cross-origin here. The first token is the fallback for a browser that does not know the second.

  4. Step 4.

    Count the per page overrides in the HTML, because a meta tag or a referrerpolicy attribute beats the header for the elements it covers.

    curl -s https://www.cloudflare.com/ | grep -coE '<meta[^>]+name="referrer"|referrerpolicy='
    
    0

    Zero means the header governs every request this document makes. A non-zero count is the list of places to read before you report the page as safe.

How to read the result

| What you see | What it means | What to do | | --- | --- | --- | | strict-origin-when-cross-origin | Full URL to your own origin, origin only to others, nothing on a downgrade | Nothing. This is the value to aim for on ordinary pages. | | no-referrer | No Referer is sent anywhere | Keep it on token pages. Expect analytics attribution to go blank. | | unsafe-url | Full URL including path and query goes to every origin | Treat as a defect on any page whose URL holds an identifier. | | origin-when-cross-origin | Origin is sent even when HTTPS downgrades to HTTP | Move to the strict- variant, which drops the header on a downgrade. | | No header at all | The browser default applies | Set the header explicitly. A default you did not choose changes with the browser. |

Thresholds

strict-origin-when-cross-origin

The policy browsers apply when a response carries no Referrer-Policy header and the document sets no override. Chrome, Firefox, Edge and Safari all ship this default, which is why a missing header is a weaker finding than it was before 2020, and still a finding.

Source: MDN Referrer-Policy, default policy note

Common mistakes

Sign: The header is correct on the homepage and the reset token still reaches a third party.Cause: The policy is a per response header. A page rendered by a different service, a static error page or a route behind another proxy can answer without it. Check the page that holds the token, not the site root.
Sign: A scan reports two conflicting policies on one page.Cause: A comma separated list is legal, not a conflict. The browser keeps the last token it understands. A real conflict is the header saying one thing and a meta referrer tag in the HTML saying another, which step 4 counts.
Sign: Analytics stops attributing traffic after the header is tightened.Cause: no-referrer removes the source of every campaign report. Use the strict origin variant when attribution matters, or set referrerpolicy on the individual outbound links that need the full URL.

What to check next

FAQ

How to check referrer policy in the browser?

Open DevTools, Network tab, click any outgoing request, then the Headers panel and read the Referer request header. That shows the value the policy produced, which is stronger evidence than the policy name.

Does the header apply to images and scripts as well as links?

Yes. The policy covers every request the document makes: images, scripts, fetch calls, form posts and navigations. A single referrerpolicy attribute on one element overrides it for that element only.

Is Referer spelled wrong?

The request header is Referer, with one r, from a typo in the original 1996 specification. The response header that controls it is Referrer-Policy, spelled correctly. Match both spellings when you grep.

Which value should a login page use?

no-referrer on any URL that carries a token, strict-origin-when-cross-origin everywhere else. Decide per route, because a site-wide no-referrer removes attribution data the marketing team depends on.

Verified

Verified by Maks Vernycurl 8.21.0

Each output block is what the command above it printed on that date, on the host named in the step. Figures read from a live site move between runs. Compare the shape of the answer rather than the digits, and see the methodology for how a page is re-verified.

basic4 minpublished updated Maks Verny