Sitewalk / Guides / Security headers / Referrer-Policy header
Referrer-Policy header: strict-origin-when-cross-origin explained
For most sites the right value is strict-origin-when-cross-origin. Your own pages get the full address of the previous page, other sites get only your domain, and nothing is sent from a secure page to an insecure one.
Here is the header as your server should send it:
Referrer-Policy: strict-origin-when-cross-origin
Below you will find what every value does, how to check your site, how to set the header and what can go wrong.
What the Referrer-Policy header controls
When someone clicks a link, or your page loads a file from another server, the browser can send a request header called Referer. It tells the receiving server which page the request came from. The Referrer-Policy response header sets how much of that address the browser shares.
The spelling differs on purpose. Referer is a historic misspelling that stayed in the web standard. Referrer-Policy is spelled correctly. If you type Referer-Policy in a server file, you have created a header that browsers do not read as a policy.
An address can carry more than a page name. Think of a search box that puts the search words in the address, a reset link with a token, or an order page with a customer number. A loose policy can hand those details to every outside server your page talks to.
Three words help with the table below:
- Origin means the scheme, host and port, such as
https://example.com. - Same origin means the request goes to your own origin.
- Cross origin means it goes anywhere else, including a different subdomain.
What strict-origin-when-cross-origin means
The name reads as two rules joined together. When the request is cross origin, send only the origin. The word strict adds that nothing is sent when you move from HTTPS down to HTTP.
Say a visitor is on https://:
| Where the request goes | What the other side receives |
|---|---|
https://example.com/help | https:// |
https://shop.example.com/ | https://example.com/ |
https:// | https://example.com/ |
http:// | Nothing |
MDN lists this value as the default when a page sets no policy, or sets one the browser does not understand. The older default was no-referrer-when-downgrade, which shared the full address with other HTTPS sites.
It is also not a CORS setting. You may see the text next to a failed request in developer tools. The referrer policy only decides what goes into the referrer. If a script is blocked from reading another server's reply, look at that server's Access-Control-Allow-Origin header.
All eight values compared
| Value | Own origin gets | Other HTTPS sites get | HTTPS to HTTP gets |
|---|---|---|---|
no-referrer | Nothing | Nothing | Nothing |
same-origin | Full address | Nothing | Nothing |
strict-origin | Origin only | Origin only | Nothing |
strict-origin-when-cross-origin | Full address | Origin only | Nothing |
origin | Origin only | Origin only | Origin only |
origin-when-cross-origin | Full address | Origin only | Origin only |
no-referrer-when-downgrade | Full address | Full address | Nothing |
unsafe-url | Full address | Full address | Full address |
The table assumes your page is on HTTPS. Pick with these questions:
- Do your own reports need to know the previous page on your site? Keep a value that shares the full address with your own origin.
- Should partners know that a visit came from your site? Keep at least the origin for other sites.
- Are your addresses private, such as an internal tool? Use
no-referrerorsame-origin. - Not sure? Use
strict-origin-when-cross-origin.
MDN warns that unsafe-url can leak private information from secure pages to insecure ones. We would not use it for a whole site.
Why set it when browsers already have a default
A missing header is not a hole in a current browser that follows the default. Setting it still helps for three reasons.
- Your intent is written down, so every browser that reads the header follows the same rule.
- A reviewer or scanner can see the choice without guessing.
- If a plugin or proxy later adds a looser value, you have something to compare against.
Treat this as a small tidy-up. It will not repair a slow or broken page, and we make no claim that it changes rankings.
How to check your header
For one page, run this in a terminal:
curl -s -o /dev/null -D - https://example.com/ | grep -i referrer-policy
No output means the reply had no such header. On our own home page on 30 Nov 2026 it printed referrer-policy: strict-origin-when-cross-origin.
To check several pages and grade the value, save this as refcheck.py:
import sys, urllib.request
VALID = {"no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin",
"same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"}
def verdict(value):
if value is None:
return "no header"
known = [t.strip().lower() for t in value.split(",") if t.strip().lower() in VALID]
if not known:
return "no value a browser knows"
if known[-1] == "unsafe-url":
return "unsafe-url sends the full address to other sites"
return "ok: " + known[-1]
for url in sys.argv[1:]:
req = urllib.request.Request(url, headers={"User-Agent": "referrer-check"})
with urllib.request.urlopen(req, timeout=15) as res:
found = res.headers.get_all("Referrer-Policy")
value = ", ".join(found) if found else None
print(url, "|", value, "|", verdict(value))
Run it with pages from each part of your site:
python3 refcheck.py https://example.com/ https://example.com/contact/
We ran it against our home page and six local test replies. It read a normal value and a comma separated list, flagged unsafe-url, flagged a misspelled value, and reported a reply with no header. It follows redirects and grades the final reply. It stops with an error when a page returns an error status.
The script reads headers only. A page can also set a policy in its HTML, covered below, so look at the source too if behaviour surprises you.
How to add the header
On Apache with the headers module enabled, add this to the site configuration or .htaccess:
<IfModule mod_headers.c> Header always set Referrer-Policy "strict-origin-when-cross-origin" </IfModule>
We tested these lines in a local Apache 2.4 server configuration. The header appeared on a normal page and on a 404 page. We did not test them inside .htaccess, so check your pages after saving.
On nginx, the line goes in the server block:
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
We have not run this nginx line ourselves. The nginx documentation says always adds the header on every response code. It also says headers from the outer level are inherited only if the current level has no add_header of its own. So a location block with any add_header line needs this one repeated, unless you use the newer add_header_inherit setting.
If you cannot edit the server, your host, CDN or security plugin may offer a response header setting. Set it in one place only. Two layers adding the header can produce two values that you did not plan.
You can set a policy in HTML as well:
<meta name="referrer" content="strict-origin-when-cross-origin">
You can also change one link or image with the referrerpolicy attribute. A link with rel="noreferrer" sends no referrer for that click. Note the spelling: the rel word has no dash, while the policy value no-referrer does.
Common mistakes
- A typo in the value.
strict-origin-when-crossoriginis missing a dash, so a browser ignores it. - Using
no-referrereverywhere, then wondering why other sites cannot see visits from you. - Assuming the header hides data in your addresses from your own server or your analytics script. It only limits the referrer.
- Putting tokens or email addresses in addresses and relying on this header to protect them. Move private data out of the address.
- Writing a list in the wrong order. A browser uses the last value in the list that it knows, so put your preferred value last.
Check it worked
- Clear your page cache and CDN cache.
- Run the script again. Each page should print
ok:followed by your value. - Check a redirect, a 404 page and a file such as an image.
- Open developer tools, select the Network tab, click a link to another site and read the
Refererrequest header. - Test sign in, payment and embedded tools. Some outside services expect to see your domain.
- Run your audit again and confirm the finding is gone.
Other headers are checked the same way. See our guides on the HSTS header, Content-Security-Policy, X-Content-Type-Options and clickjacking protection.
What Sitewalk found on real sites
Counted on 30 Nov 2026: 76 of 120 eligible audited sites (63.3%) sent no Referrer-Policy header on the home page. None of the 120 sent a value that Sitewalk grades as unsafe or unknown. Eligible means the site's latest audit ran after this check was added on 4 Nov 2026. It is a small early user group, a first look and not a survey.
The check reads the home page reply only. Your other pages can differ.
Questions people ask
What is strict-origin-when-cross-origin?
It is a referrer policy value. Your own origin receives the full address, other secure sites receive only your origin, and insecure destinations receive nothing from a secure page.
Is strict-origin-when-cross-origin a CORS error?
No. It describes what goes into the referrer. A CORS failure is about whether the other server allows your script to read its reply.
Which Referrer-Policy value should I use?
Start with strict-origin-when-cross-origin. Choose same-origin or no-referrer when outside sites should learn nothing about your pages.
Is a missing Referrer-Policy header a problem?
It is a minor finding. Current browsers fall back to a safe default, and setting the header makes your choice explicit.
Does this header affect my analytics?
It can. A stricter value on a site that links to you means your reports see less about where visits began. Your policy controls what you pass on to others.
Check your whole site in one sentence
Audit example.com for technical SEO problems
Checked on 30 Nov 2026. Sources: MDN Referrer-Policy reference, W3C Referrer Policy and nginx headers module, read on 30 Nov 2026. Sitewalk counts are from audits counted on 30 Nov 2026.
More guides
- Content Security Policy header: check it and add one
- HSTS header: check it and set max-age to one year
- X-Content-Type-Options: check it and add nosniff
- X-Frame-Options: check your clickjacking protection
- llms.txt: what it is, how to check yours and fix it
- AI crawlers and robots.txt: what to allow and block