Content-Security-Policy & Security Headers Generator
Compose a production-ready CSP with HSTS, X-Frame-Options, Referrer-Policy and Permissions-Policy, then copy the exact config for Nginx, Caddy or Cloudflare. Everything runs locally in your browser.
max-age
Why is 'unsafe-inline' flagged in script-src?
Any inline script allowed by 'unsafe-inline' can be injected by an attacker who finds an HTML injection point, so the policy stops blocking XSS. Prefer a per-request nonce (enable the nonce option) or a hash-based policy and keep 'strict-dynamic' enabled.
Do I need both CSP frame-ancestors and X-Frame-Options?
CSP frame-ancestors supersedes X-Frame-Options in modern browsers, but X-Frame-Options is still honoured by older engines. Sending both (as this generator does by default) is the safe combination; if you embed your site in an iframe, set frame-ancestors 'self' and X-Frame-Options to SAMEORIGIN.