Security headers generator

Pick your headers, then export them as Apache .htaccess, an Nginx server block, or a Cloudflare Pages _headers file. Everything runs in this page — copy the output when ready.

Format

Transport & framing

Privacy & permissions

Comma-separated directives. Empty = omit the header.

Content-Security-Policy

Start with default-src 'self'. Deploy in Report-Only first, watch violations, then enforce.

Headers output

 

Notes on security headers

Start with Report-Only CSP
A wrong CSP can break your site instantly. Deploy Content-Security-Policy-Report-Only first, check the console for violations, then switch to enforce.
HSTS is a commitment
Once browsers see HSTS with a long max-age, they refuse plain HTTP until it expires. Test with a short max-age first; only use preload if you fully understand the submission process.
Permissions-Policy
Disables powerful browser features (camera, mic, etc.) you probably don't use. Keep the list conservative — blocking something you need causes silent failures.
Server vs meta
These headers are set by the web server or CDN, not by HTML. If your host doesn't let you set them, ask support or move behind a CDN that does.

Combine with .htaccess redirects for a hardened Apache setup, or browse all tools.