ReconSnapshot--:--:--ZUTC

Web & certificates · Guide

How to Fix Missing Security Headers

Add the low-risk headers first, then HSTS, then Content-Security-Policy in report-only mode before enforcing it. Check your site below, apply the configuration for your server, and re-check.

By DarkFire Industries · Reviewed · How this guide was made

Step 1: the low-risk headers

These rarely break anything:

X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
X-Frame-Options: DENY
Permissions-Policy: camera=(), microphone=(), geolocation=()

Use SAMEORIGIN instead of DENY if your own site frames its pages.

Try it Check which headers are missing

Full tool: Security Headers Checker

Step 2: HSTS

Strict-Transport-Security: max-age=31536000; includeSubDomains

Only add it once every subdomain works over HTTPS: browsers will refuse plain HTTP for the whole max-age. Start with a short max-age (for example 300) if unsure. Add preload only if you intend to submit to the browser preload list, which is hard to undo.

Step 3: Content-Security-Policy

Deploy as Content-Security-Policy-Report-Only first, review the violations in the browser console or your report endpoint, then switch the header name to enforce. A starting point for a simple site:

default-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'

Add the exact domains your site loads scripts, fonts and analytics from.

Where to add them

Nginx — in the server block: add_header X-Content-Type-Options "nosniff" always;

Apache — with mod_headers: Header always set X-Content-Type-Options "nosniff"

Cloudflare — Rules → Transform Rules → Modify Response Header, or in a Worker.

Netlify / Cloudflare Pages — a _headers file in the site root:

/*
  X-Content-Type-Options: nosniff
  Referrer-Policy: strict-origin-when-cross-origin
What each security header protectsHeaders are instructions sent with every response. Each switches on a browser protection against a specific attack.ServerHTTP responseBrowserenforcesStrict-Transport-Securitystops HTTPS downgradeContent-Security-Policystops injected scripts (XSS)X-Frame-Optionsstops clickjackingX-Content-Type-Optionsstops MIME sniffingReferrer-Policystops URL leakage
What each security header protects. Headers are instructions sent with every response. Each switches on a browser protection against a specific attack.

Verify the fix

Re-run the checker above. Headers are cached by CDNs, so purge the cache if a change does not appear. Then browse key pages with the developer console open to catch CSP violations.

See the whole picture

Run the full Recon Snapshot to check DNS, email authentication, certificates, hosting, exposed services, security headers and lookalike domains together, with a plain-English fix for every finding.

Run a full snapshot

References

  1. OWASP HTTP Headers Cheat Sheet
  2. MDN — Strict-Transport-Security
  3. MDN — Content Security Policy (CSP)
  4. HSTS Preload List submission requirements

About this guide

Drafted with AI assistance and checked against the primary sources listed above; its embedded tool was tested against live domains before publication. It was last checked on November 25, 2026; standards and provider requirements change, so confirm critical settings against the references. Found an error? Tell us.

Related guides