Skip to main content
LowHeadersOWASP A05:2021CWE-200

How to fix: Missing Referrer-Policy Header

The Referrer-Policy header is not set. This controls how much referrer information is sent with requests.

Why it matters

Sensitive information in URLs (tokens, IDs) may be leaked to third-party sites through the Referer header.

By default, browsers send the full URL in the Referer header when navigating between pages. If your URLs contain sensitive data, this data leaks to any external site the user visits next.

How to fix it

  1. 1Add Referrer-Policy: strict-origin-when-cross-origin (recommended).
  2. 2For maximum privacy, use no-referrer or same-origin.
  3. 3Avoid using unsafe-url which sends the full URL to all origins.

Code examples

Next.js

JavaScript
const nextConfig = {
  async headers() {
    return [{
      source: '/(.*)',
      headers: [{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' }],
    }];
  },
};

Nginx

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

Apache

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

Caddy

PLAINTEXT
header Referrer-Policy "strict-origin-when-cross-origin"

Express (Node.js)

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

Deno (Hono)

TypeScript
app.use('*', async (c, next) => {
  await next();
  c.header('Referrer-Policy', 'strict-origin-when-cross-origin');
});

Bun (Elysia)

TypeScript
app.onAfterHandle(({ set }) => {
  set.headers['Referrer-Policy'] = 'strict-origin-when-cross-origin';
});

HTML Meta Tag

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

References

Detected automatically by VulnRadar. The check id is referrer-policy-missing, stable across every scan so you can filter or diff on it.

See every headers check

Questions

How severe is Missing Referrer-Policy Header?
VulnRadar rates this low severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id referrer-policy-missing, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Missing Referrer-Policy Header map to?
It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for missing referrer-policy header

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Missing Referrer-Policy Header | VulnRadar