Referrer-Policy header

Controls how much of the current URL the browser sends in the Referer header when users follow links or load resources from other sites.

Updated 3 November 2026

Check your site's Referrer-Policy header

We send one normal request (following redirects) and grade the Referrer-Policy header on the final response.

Recommended value

Referrer-Policy: strict-origin-when-cross-origin
Value / directiveWhat it does
no-referrer Never send a Referer.
same-origin Full URL to your own origin, nothing to other sites.
strict-origin Only the origin (https://example.com), and nothing when going from HTTPS to HTTP.
strict-origin-when-cross-origin Full URL within your site, only the origin to other sites, nothing on HTTPS to HTTP. The default in current browsers.
origin / origin-when-cross-origin Like the strict versions but still sent on HTTPS to HTTP downgrades.
no-referrer-when-downgrade Full URL to every HTTPS site. The old default. Leaks paths and query strings.
unsafe-url Full URL everywhere, including over HTTP. Avoid.

Why it matters

The Referer header can carry the full URL a user was on, path and query string included. URLs often contain more than you think: password reset tokens, invite codes, search terms, internal IDs, signed download links. When that page loads a third-party script, image or font, or the user clicks an external link, the full URL can be sent to that third party and end up in their logs.

Which value to use

strict-origin-when-cross-origin is the sensible default: your own analytics still see full paths, other sites only see your domain. Current browsers already apply it when no header is set, but setting it explicitly protects users on older browsers and documents your intent.

For pages that carry secrets in the URL (password reset, magic links, signed URLs), use no-referrer on those responses, or move the token out of the URL.

Per-element overrides

You can loosen or tighten the policy for one link or resource with referrerpolicy="no-referrer" on <a>, <img>, <script> and <iframe>, or with rel="noreferrer" on links.

How to set Referrer-Policy

nginx

# inside your server { } block
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

Apache

# .htaccess or virtual host (needs mod_headers)
Header always set Referrer-Policy "strict-origin-when-cross-origin"

Laravel middleware

// app/Http/Middleware/SecurityHeaders.php
public function handle(Request $request, Closure $next): Response
{
    $response = $next($request);
    $response->headers->set('Referrer-Policy', 'strict-origin-when-cross-origin');

    return $response;
}

// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
    $middleware->append(\App\Http\Middleware\SecurityHeaders::class);
})

Express (Node.js)

app.use((req, res, next) => {
  res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
  next();
});

// or: app.use(require('helmet')()) for a sensible default set

Cloudflare

Rules → Transform Rules → Modify Response Header → Create rule.
Match: all incoming requests (or your hostname).
Then: Set static → Header name: Referrer-Policy → Value: strict-origin-when-cross-origin

In nginx, an add_header inside a location block discards every add_header inherited from the server block. Repeat your security headers there, or use an include file. The always flag also sends the header on error responses.

Common mistakes

  • Using unsafe-url or no-referrer-when-downgrade to "fix" analytics. That sends full URLs, query strings included, to every third party.
  • Keeping password reset or invite tokens in URLs on pages that load third-party scripts.
  • Typos such as strict-origin-when-crossorigin. Unknown values are ignored and the browser default applies.

FAQ

What is the best Referrer-Policy?

strict-origin-when-cross-origin for most sites, and no-referrer on pages whose URLs contain tokens or other secrets.

What is the default Referrer-Policy?

Current versions of Chrome, Firefox, Safari and Edge default to strict-origin-when-cross-origin when no policy is set.

Does Referrer-Policy affect my analytics?

Cross-site referrals still show the referring domain, just not the full path. Your own site still sees full internal referrers.

Headers are one of 30+ things attackers check

The free StackShield scan also checks for exposed .env files, debug mode, leaked tooling, weak TLS and more, from the outside, in about a minute.

Run a free scan