Referrer Policy Best Practice and Permissions-Policy Fix

, by xura.tools team

TL;DR: Add these two headers:

Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()

The first limits how much of your URLs other sites see. The second turns off browser features you don't use. Only list features in Permissions-Policy that your site really doesn't need. Check both with our security headers tool.

What the warnings mean

Scanners print "Referrer-Policy header not set" and "Permissions-Policy header not set" when those headers are missing. They are smaller findings than a missing CSP or HSTS. Neither is a hole you can be attacked through directly. They are about privacy and limiting damage.

Referrer-Policy: what it does

When someone clicks a link on your site, or your page loads an image or script from another site, the browser can send a Referer header with the address of your page. Yes, the header is misspelled, it has been since the 90s.

That address can say more than you want. Think of https://example.com/reset-password?token=abc123 or https://example.com/search?q=private+medical+question. If that page loads a third-party script or the user clicks an outside link, the full URL might go with it.

Referrer-Policy controls how much is sent. The main values, from MDN:

Referrer policy best practice

strict-origin-when-cross-origin is the right default for most sites. Your own analytics still see full paths for internal navigation. Other sites only learn that the visitor came from example.com.

It's also what modern browsers use when you send nothing. MDN says it became the default in the spec in November 2020, replacing no-referrer-when-downgrade. So why set it? Because then you decide, not the browser version. And scanners want to see it.

Go stricter when your URLs hold private data. Use same-origin or no-referrer on sites where paths or query strings contain tokens, emails, or search terms people wouldn't want shared. The cost: partner sites and your own outbound-link tracking lose referral data.

You can send a fallback list. The browser uses the last value it understands. GitHub sent this when we checked on December 5, 2026:

referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin

Permissions-Policy: what it does

Permissions-Policy tells the browser which features your page and its iframes may use: camera, microphone, geolocation, payment, USB, fullscreen and many more. It used to be called Feature-Policy, with a different syntax.

The syntax is feature=allowlist, separated by commas:

The real benefit is limiting damage. If a third-party script, an ad iframe or an XSS bug tries to turn on the camera or read location, the browser refuses before it even asks the user. Without the header, nothing breaks and nothing is open by default, since the user still gets a permission prompt. That's why its a hardening step, not an emergency.

Support is not universal. MDN marks the header as not Baseline because it doesn't work in some widely used browsers. Browsers that don't know it just ignore it, so sending it is safe.

Permissions policy header example

A safe start for a site that uses none of these:

Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=()

Real example: www.cloudflare.com sent permissions-policy: geolocation=(), camera=(), microphone=() on December 5, 2026. See it in our live check.

Before you copy a long list from somewhere:

How to add them on your server

nginx

server {
    listen 443 ssl;
    server_name example.com;

    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
}

always sends them on error pages too. Watch the inheritance rule: add_header lines are inherited from the parent block only if the current block has none. A single add_header in a location drops these two there. Repeat them, use an include snippet, or on nginx 1.29.3+ use add_header_inherit merge; (nginx docs).

Apache (.htaccess)

Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"

Needs mod_headers and AllowOverride FileInfo.

Caddy

example.com {
    header {
        Referrer-Policy "strict-origin-when-cross-origin"
        Permissions-Policy "camera=(), microphone=(), geolocation=()"
    }
    reverse_proxy localhost:3000
}

IIS (web.config)

<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Referrer-Policy" value="strict-origin-when-cross-origin" />
        <add name="Permissions-Policy" value="camera=(), microphone=(), geolocation=()" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>

Cloudflare (Transform Rules / _headers for Pages)

Go to Rules > Overview > Create rule > Response Header Transform Rule, apply to all requests, add two Set static operations (one per header), then Deploy. Note that Cloudflare's Add security headers managed transform sets referrer-policy: same-origin, which is stricter than the value above. It doesn't add Permissions-Policy.

On Cloudflare Pages, add _headers to your build output:

/*
  Referrer-Policy: strict-origin-when-cross-origin
  Permissions-Policy: camera=(), microphone=(), geolocation=()

Next.js (next.config.js headers())

// next.config.js
module.exports = {
  async headers() {
    return [
      {
        source: '/(.*)',
        headers: [
          { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
          { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
        ],
      },
    ];
  },
};

Express (helmet)

import express from 'express';
import helmet from 'helmet';

const app = express();
app.use(helmet({ referrerPolicy: { policy: 'strict-origin-when-cross-origin' } }));
app.use((req, res, next) => {
  res.setHeader('Permissions-Policy', 'camera=(), microphone=(), geolocation=()');
  next();
});

Helmet's default Referrer-Policy is no-referrer, the strictest one. Helmet doesn't set Permissions-Policy in its defaults, so the small middleware adds it.

Spring Boot

Spring Security sends neither header by default. Add them to your SecurityFilterChain:

http.headers(headers -> headers
    .referrerPolicy(r -> r.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN))
    .permissionsPolicyHeader(p -> p.policy("camera=(), microphone=(), geolocation=()")));

permissionsPolicyHeader exists since Spring Security 6.4. On older versions use permissionsPolicy, which 6.4 deprecated.

WordPress (plugin-free option)

In your child theme's functions.php or a file in wp-content/mu-plugins/:

add_action( 'send_headers', function () {
    header( 'Referrer-Policy: strict-origin-when-cross-origin' );
    header( 'Permissions-Policy: camera=(), microphone=(), geolocation=()' );
} );

This only covers pages PHP renders. That's fine for these two headers, they matter on HTML pages.

How to check it worked

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

Each should print one line. Then run your domain in the security headers tool to see these next to the other four headers it grades.

Common mistakes

  1. Spelling. The header is Referrer-Policy with double r. Only the request header Referer is misspelled.
  2. Using unsafe-url or no-referrer-when-downgrade. Both leak full URLs to other sites.
  3. Old Feature-Policy syntax. camera 'none' is the old format. In Permissions-Policy it's camera=().
  4. Quotes in the wrong place. Origins go in double quotes inside the parentheses: geolocation=(self "https://a.example"). The keyword self has no quotes.
  5. Blocking a feature you use, then wondering why the payment button or video fullscreen stopped working.

FAQ

What is the referrer policy best practice?

strict-origin-when-cross-origin for most sites. Use same-origin or no-referrer if your URLs carry private data.

What does strict-origin-when-cross-origin mean?

Full URL for links within your site, only the domain for other HTTPS sites, and nothing when going from HTTPS to HTTP.

Permissions policy header not set: is it a problem?

Not a vulnerability on its own. Browsers still ask users before using the camera or location. The header just lets you block those features fully, including in iframes.

Do I still need the Feature-Policy header?

No. Permissions-Policy replaced it. Send the new one.

Fixing these two? The other common ones are X-Frame-Options and X-Content-Type-Options.


Is your site affected? Run the free P-256 check.