Security Headers Generator
Pick the headers you want, copy the exact config for your server. The fix-side companion to the headers checker.
Runs entirely in your browser — nothing is transmitted anywhere.
1 · Choose headers
2 · Pick your platform
How it works
Choose the controls you want and the platform that owns the public response. The generator fills a fixed template for that platform in your browser. Review the output against the site's HTTPS coverage, resource origins and embedding requirements before deployment. A useful baseline depends on what your pages actually need to do.
| Header | What the generated value does |
|---|---|
| Strict-Transport-Security | Instructs browsers that receive it
over HTTPS to use HTTPS for future connections. The template uses max-age=31536000
and includeSubDomains, a one-year policy covering the issuing host and its
descendants. Confirm HTTPS coverage first. Keep preload off during initial rollout. |
| Content-Security-Policy | default-src 'self' is the
same-origin fallback for applicable fetch directives. The template separately limits
base URLs and form targets with base-uri 'self' and form-action 'self'.
Inventory off-origin assets and inline code before enforcing. |
| X-Content-Type-Options | nosniff blocks script and
style requests with incompatible MIME types. Check Content-Type on your
scripts and stylesheets, including responses served from a CDN. |
| X-Frame-Options | DENY forbids framing, including
same-origin framing. Selecting this also adds frame-ancestors 'none' to the
generated CSP when CSP is enabled. Review pages designed for embedding. |
| Referrer-Policy | strict-origin-when-cross-origin
sends the full referrer URL for same-origin requests, only the origin for eligible
cross-origin requests, and no referrer on an HTTPS-to-HTTP downgrade. |
| Permissions-Policy | Empty allowlists deny camera, microphone, geolocation and payment features in supporting browsers. Check that your own app and the frames it embeds can operate with those permissions disabled. |
The server-version option controls a separate platform setting. nginx and Apache reduce
version disclosure, Caddy emits a directive to remove Server, and IIS uses
request filtering where supported. The Cloudflare Pages template emits a comment for this
option. Express disables X-Powered-By. Verify what your public edge sends
after any proxy or CDN processes the response.
Choose a baseline before applying stricter values
With correct response MIME types, nosniff and the generated referrer
policy make a practical starting point. Set framing and permissions according to
the features each route uses. If you need to suppress all referrer information, use
no-referrer and test integrations that rely on it. Treat the generated
one-year HSTS lifetime and enforced CSP as rollout targets that need testing.
OWASP
HTTP headers guidance
Deploy on the server that sets the response
- nginx.
Merge the
add_headerlines into the intendedserverblock. Check child locations with their ownadd_headerdirectives because default inheritance can drop the parent headers. Runnginx -t, then reload. - Apache.
Enable
mod_headersand merge theHeader always setlines into your virtual host or an allowed.htaccesscontext. PutServerTokensin the main server config. Check for duplicate fields from a backend, runapachectl configtestand reload using your service controls. - Caddy.
Merge the
headerblock into the destination site block in the Caddyfile. Validate and reload that configuration, then check both static and proxied paths. - Cloudflare Pages.
Merge the path rule into
_headersin the published output directory and deploy a preview. Attach headers in the response code for routes generated by Pages Functions. - IIS.
Merge the entries into the existing site's
web.configundersystem.webServer/httpProtocol/customHeaders. Resolve inherited entries for the same header before adding a new value. Check Windows and IIS support before usingremoveServerHeader. - Express. Register the generated middleware before the routes and static handlers that send responses. If middleware or a reverse proxy already sets a header, decide which layer should own it and verify the public response.
Worked example: stage HSTS and CSP separately
Suppose example.com uses HTTPS, but legacy.example.com still
serves HTTP. Start with a short, host-only HSTS policy on the main host by editing the
generated value. Fix HTTPS on the legacy host before enabling includeSubDomains.
Increase the lifetime after validation. The HSTS guide
covers the ramp-up. Preload requires an additional submission and removal can take months.
Check the preload requirements before opting in.
Suppose the same site loads a stylesheet from assets.example.org. Start
with CSP Report-Only and exercise the affected pages. Add a scoped style source if the
dependency is approved. The generator does not configure a report destination. Add and
test one before relying on collected reports. Follow the
CSP report-only rollout guide before enforcing.
What to do with your result
Run the Security Headers Checker against representative public HTTPS URLs after deploying. Inspect raw response headers in browser developer tools for duplicate fields, redirects and error responses. Confirm that login, forms, assets, embeds and permission-dependent features still work. Record which layer sets each header so later changes have a clear owner.
FAQ
Can I deploy every generated header as-is?
Review the values against your site. Correct MIME types before enabling nosniff, check framing and permissions needs, and stage CSP and HSTS changes.
Is CSP Report-Only enough to protect a page?
Report-only observes violations without blocking them. Add a reporting destination to collect reports and enforce the policy once you have tested the required flows.
Do I need X-Frame-Options with frame-ancestors?
Supporting browsers give enforced frame-ancestors precedence. X-Frame-Options can cover older clients. Keep the two policies compatible with the page's intended framing.
Does adding preload submit my domain?
The option only adds the preload directive. Review the eligibility requirements and submit separately if you can sustain HTTPS for the domain and its subdomains.
Why does the checker report a missing header after I deployed it?
Check the public hostname and response path. A proxy, routed function, configuration scope or redirect can produce different headers from the response you tested at the origin.
Can the generator remove the Server header everywhere?
The setting has different effects by platform. Check the final response for Server and X-Powered-By after the application and its public edge have handled the request.
From the channel
XSS Explained — See a Website Get Hijacked Live
Watch safe, hands-on security demonstrations for complete beginners on The Exploit HQ ▸
One URL. The Session Cookie in the Response.
Watch safe, hands-on security demonstrations for complete beginners on The Exploit HQ ▸
kev brief
Patch what's actually being exploited.
Subscribe and get the KEV Patch Priority Playbook, free, in your inbox now.
Free. No spam. Unsubscribe anytime. Delivered by Beehiiv.