How to use it

  1. On Generate headers, pick your web server or proxy and what it’s serving.
  2. For a website, tick what it uses: AdSense, Google Analytics, Google Fonts or YouTube embeds. The policy changes to allow exactly those.
  3. Copy the config, follow the line under it to put it in place, and reload.
  4. Run curl -sSI https://your-site/ and paste the output into Check my headers to confirm they’re all there.

What each header does

Header What it stops
Strict-Transport-Security (HSTS) Browsers ever using plain HTTP for your site again, so nobody can quietly downgrade the connection
Content-Security-Policy Injected scripts running, by listing where scripts, styles and images may come from
X-Frame-Options Other sites loading yours in a hidden frame to trick clicks (clickjacking)
X-Content-Type-Options Browsers guessing that an uploaded file is a script
Referrer-Policy Full page addresses, which can include private links, leaking to other sites
Permissions-Policy Embedded content asking for the camera, microphone or location
Cross-Origin-Opener-Policy Pages you open reaching back into yours

X-XSS-Protection isn’t on the list. Modern browsers dropped the filter it controlled, and OWASP recommends leaving it out or setting it to 0.