HTTP Security Header Helper

Build and audit CSP, HSTS, X-Frame-Options and related headers.

The HTTP Security Headers generator builds a set of response headers for hardening a website, and writes them as nginx, Apache or Express code. You start from a Basic, Strict or API preset and then edit the Content-Security-Policy directives and the other headers. It is a starting point for configuring a server, not a full security audit.

What are HTTP security headers?

Security headers are HTTP response headers that tell the browser to apply extra protections to a page. Content-Security-Policy restricts where scripts, styles, images and frames may load from, which limits the damage of injected markup. Strict-Transport-Security tells the browser to use HTTPS only for a set time. X-Frame-Options and the frame-ancestors directive control whether other sites can embed the page. X-Content-Type-Options set to nosniff stops the browser from guessing content types. Referrer-Policy controls how much of the URL is sent in the Referer header, and Permissions-Policy turns browser features such as the camera on or off. Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy isolate the page from other origins. They are a defence in depth layer and do not replace safe coding.

How to use HTTP Security Header Helper

  1. Choose a preset Pick Basic, Strict or API under Preset.
  2. Choose the server Select nginx, Apache or Express under Output.
  3. Adjust the headers Edit the Content-Security-Policy directive fields and the Other headers such as Strict-Transport-Security, X-Frame-Options and Referrer-Policy.
  4. Copy the configuration Copy the Configuration box or download it, then add it to your server config and test it.

Frequently asked questions

Which preset should I pick?

Basic is a balanced start for ordinary sites. Strict suits sites that only use their own scripts and styles. API suits endpoints that return data and no HTML.

Is X-Frame-Options still needed?

The frame-ancestors CSP directive is the modern control and takes precedence in current browsers. X-Frame-Options covers older ones.

What does HSTS preload do?

It signals that you want the domain in browser preload lists so HTTPS is forced from the first visit. Removing a domain from those lists is slow, so enable it only when sure.

Does this guarantee my site is secure?

No. Headers reduce certain risks, but they do not fix vulnerable code. Test the result in a browser and with a header scanner.

Where does the output go?

For nginx, inside a server or location block. For Apache, in the config or .htaccess with mod_headers enabled. For Express, before your routes.

Is my configuration uploaded?

No. The text is built in the page and is not sent anywhere.