Security Headers Generator

Choose the HTTP security headers you want and get them as nginx, Apache, Netlify, Vercel, Cloudflare Pages or Express code, with notes on each.

Processed on your device. Files are not uploaded

How to add security headers

  1. Tick the headers

    Each one has a short label.

  2. Choose your platform

    nginx, Apache, Netlify, Vercel, Cloudflare Pages or Express.

  3. Copy or download

    Paste the config into your server or host settings.

Worked example

This is what Security Headers Generator gives for its own sample values. Open the tool above and change anything to try your own.

For
nginx
Strict-Transport-Security (HTTPS only)
Yes
HSTS: include subdomains
No
X-Content-Type-Options: nosniff
Yes
Framing (X-Frame-Options)
SAMEORIGIN: only your own site
Referrer-Policy
strict-origin-when-cross-origin

Headers

add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;

About Security Headers Generator

Build the HTTP security headers that harden a site: Strict-Transport-Security, X-Content-Type-Options, framing rules, Referrer-Policy, Permissions-Policy and the cross-origin policies, written for the platform you use.

FAQs

What does HSTS do?

It tells browsers to connect only over HTTPS, for a set time. Turn it on only once all of your site works over HTTPS.

What about Content-Security-Policy?

It is the most powerful header but needs care. Use CSP Generator.

How do I test it?

Open your site in the browser tools, or use an online scanner for headers.

Related tools