Security Headers Generator and Checker

Get security headers that protect your site without breaking it. Pick your server and what the site uses, copy the config, then paste your live headers to check the result.

🔒 Runs entirely in your browser. Headers you paste are never sent anywhere, and cookie values are never shown.

The site uses

Config

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

HeaderWhat it stops
Strict-Transport-Security (HSTS)Browsers ever using plain HTTP for your site again, so nobody can quietly downgrade the connection
Content-Security-PolicyInjected scripts running, by listing where scripts, styles and images may come from
X-Frame-OptionsOther sites loading yours in a hidden frame to trick clicks (clickjacking)
X-Content-Type-OptionsBrowsers guessing that an uploaded file is a script
Referrer-PolicyFull page addresses, which can include private links, leaking to other sites
Permissions-PolicyEmbedded content asking for the camera, microphone or location
Cross-Origin-Opener-PolicyPages 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.

Roll out without breaking anything

  • Content Security Policy: start in test mode. The full policy goes out as Content-Security-Policy-Report-Only, which blocks nothing and logs anything it would have blocked to the browser console. Click through your site with developer tools open, fix or allow what shows up, then switch to Enforce.
  • HSTS: step up the stages over a few weeks: 5 minutes, a week, a month, then a year. A mistake at a year keeps visitors away from anything HTTP-only for a year. Only tick “all subdomains” if every subdomain works over HTTPS, including internal ones.
  • Nginx: if a location block has even one add_header line of its own, nginx drops every header set at the server level for that location. That’s why the tool makes a snippet file you include in each place.

Why AdSense sites get a smaller policy

A strong policy lists every site allowed to run scripts on your pages. Google won’t publish that list for AdSense, because the addresses its ads use keep changing. It only supports a policy built on a new random value (a nonce) in every page load, which needs code running on the server for each request. A static site such as Hugo can’t do that.

So with AdSense ticked, the tool enforces only the safe parts: no old plugins, no <base> tag tricks and no framing by other sites. That still fixes the most common scanner warnings without risking your ad income. If some pages handle anything sensitive, like a password generator, consider turning ads off on just those pages and giving them the full policy.

Self-hosted apps and Nextcloud

Apps like Jellyfin, Home Assistant and Vaultwarden usually send their own Content Security Policy, and a generic one added at the proxy often breaks them. For apps, the tool adds the safe headers and only a minimal policy.

Nextcloud checks its own headers under Administration settings, Overview. The Nextcloud preset matches what it looks for, such as Referrer-Policy: no-referrer and X-Robots-Tag: noindex, nofollow, and adds no policy of its own because Nextcloud sends one with per-page nonces. On Apache, Nextcloud’s .htaccess already sends most of these headers, so the tool only adds HSTS.

FAQ

Is a high grade the goal? No. The goal is a site that’s safe and still works. An AdSense site with the safe basics is in a much better place than one with a strict policy that quietly breaks ads or analytics.

Why does the checker say a header was sent twice? Usually both your proxy and the app behind it add it. Some browsers ignore a header that appears twice, so remove one of them.

Can’t you just fetch my site and check it? Browsers don’t let one website read another site’s headers, so that would mean running a server that fetches any address on request. Pasting curl output keeps everything in your browser.

Is anything sent to a server? No. The config is built and your headers are checked in your browser.