Guides · Website security · Updated 2026-12-04

HTTP security headers: what to set and how to check them in bulk

Security headers tell the browser how to protect your visitors: always use HTTPS, which scripts may run, whether your page may be framed. They cost nothing, yet they are often missing, and auditors, cyber-insurance questionnaires and supplier security reviews ask for them.

The headers that matter

  • Strict-Transport-Security (HSTS): forces HTTPS on future visits
  • Content-Security-Policy (CSP): limits where scripts, styles and frames may load from, the strongest protection against cross-site scripting
  • X-Frame-Options or CSP frame-ancestors: stops other sites framing your pages (clickjacking)
  • X-Content-Type-Options: nosniff: stops browsers guessing file types
  • Referrer-Policy: controls how much of your URL is sent to other sites
  • Permissions-Policy: turns off browser features you do not use, such as camera or geolocation

Safe starting values

These values suit most sites. Start CSP in report-only mode if your site loads many third-party scripts, then enforce it once nothing legitimate is reported.

Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
Content-Security-Policy-Report-Only: default-src 'self'; frame-ancestors 'none'

Where to add them

In your web server (Nginx add_header, Apache Header set), in your CDN (for example Cloudflare rules, or a _headers file on static hosts) or in your application. Test after each change: a CSP that is too strict can break scripts and forms.

Also remove what leaks

Server and X-Powered-By headers that show exact software versions help attackers choose an exploit. Hide version numbers in your server configuration.

Check one site, or hundreds

For one site, open your browser's developer tools, go to Network, click the page and read the response headers. For many sites, our Bulk Website Security Checker grades every site A–F and lists each missing header with the fix, plus certificate expiry and cookie flags.

Questions

Is HSTS risky?
Only if some subdomains do not support HTTPS: with includeSubDomains, browsers refuse plain HTTP for all of them. Check your subdomains first, and add preload only when you are sure.
Do security headers affect SEO?
They are not a direct ranking factor, but HTTPS is, and a hacked or defaced site loses rankings fast.
Is X-XSS-Protection still needed?
No. Modern browsers ignore it. Use a Content-Security-Policy instead.

General technical information, not legal advice or a security audit. Example values must be adapted and tested on your own site.