Fix guides · Security

How to add a Referrer-Policy header

Control how much of your page addresses other sites can see when visitors follow links. Low risk on modern browsers, but quick to set. Steps for Shopify, WordPress, Webflow, Wix, Squarespace and Next.js.

Time to fix
5–10 minutes
Skill needed
Copy and paste
Who notices
Visitors' privacy when they leave your site

Why it matters

When a visitor clicks a link to another site, the browser can tell that site which page they came from. If your addresses contain private details (an order number, a search, a reset token), those can leak.

Modern browsers already default to a safe policy, so this is a low-priority fix. Setting the header makes the behavior the same in every browser, including older ones.

“However, there are more problematic uses such as tracking or stealing information, or even just side effects such as inadvertently leaking sensitive information.”

MDN: Referer header, privacy and security concerns

Before you start

  • Use strict-origin-when-cross-origin. Other sites only see your domain, never the full page address, and your own analytics keep working.
  • It's also the default in modern browsers, so this won't change anything visitors notice.

Fix it on your platform

Shopify Managed by the platform

  1. Shopify runs the servers for your store and doesn't let stores on its standard plans add or change response headers, so there's nothing to edit in your theme.
  2. If this check matters to you (for example, for a security questionnaire), ask Shopify support about Referrer-Policy for your store. Stores on Shopify Plus or a headless setup (Hydrogen) can set their own headers.

WordPress

  1. Where you add the header depends on your hosting, not WordPress itself. First check your host's dashboard: many managed WordPress hosts have a security-headers setting.
  2. On Apache hosting, add the line below to the .htaccess file in your site's root folder (back the file up first). On Nginx, add it to your site's server block, or ask your host to.
  3. If your site runs through Cloudflare with the orange-cloud proxy on, you can add the header there instead, with a Response Header Transform Rule.
.htaccess (Apache)
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Nginx
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

Webflow Managed by the platform

  1. Webflow only allows custom security headers on Enterprise plans. On other plans, this header can't be added.
  2. On Enterprise, add it in Site settings → Publishing → Custom Headers.

Wix Managed by the platform

  1. Wix doesn't offer a setting for custom response headers, so this can't be added from the Wix Editor.
  2. If you need it for compliance, contact Wix support and ask how they handle this header on your domain.

Squarespace Managed by the platform

  1. Squarespace has no setting for custom response headers, and code injection adds code to your pages, not headers.
  2. If you need it for compliance, contact Squarespace support and ask how they handle this header on your domain.

Next.js

  1. Add the header for every route in next.config.ts using headers().
  2. If you host on Vercel or Netlify, you can set it in vercel.json or netlify.toml instead; use one place, not both.
next.config.ts
const nextConfig = {
  async headers() {
    return [
      {
        source: "/:path*",
        headers: [{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }],
      },
    ];
  },
};

export default nextConfig;

Any other site

  1. Add the header where your site is served from: your web server, hosting control panel or CDN. Pick the example that matches your setup.
  2. Cloudflare (proxied, orange cloud): add it with a Response Header Transform Rule.
Netlify _headers
/*
  Referrer-Policy: strict-origin-when-cross-origin
.htaccess (Apache)
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Nginx
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

Check that it's fixed

  • Re-run your StudioLNC audit: the "Missing Referrer-Policy header" issue should be gone.

Find every issue like this on your site

Free audit of performance, accessibility, SEO and security, with fixes for your platform.