Website Securityintermediateexplainer

Security Headers Explained

What each HTTP security header protects against, sensible starting values, and the order to deploy them without breaking your site.

Cyber Security Space editorial desk · Published 6 Aug 2026 · Updated 24 Aug 2026 · 2 min read · Reviewed 24 Aug 2026

Short answer

HTTP security headers are response headers that instruct the browser to restrict risky behaviour: Content-Security-Policy limits which resources can load, Strict-Transport-Security forces HTTPS, X-Content-Type-Options stops MIME sniffing, Referrer-Policy limits URL leakage, and Permissions-Policy disables unused browser features.

Key takeaways

  • Headers reduce the impact of injection and misconfiguration; they do not prevent a compromise.
  • Content-Security-Policy delivers the most value and needs the most testing — deploy it in report-only mode first.
  • HSTS is effectively irreversible for the max-age you set, so start with a short window.
  • X-XSS-Protection is obsolete; do not add it to new configurations.

What each header does

HeaderProtects againstReasonable starting value
Content-Security-PolicyInjected scripts and unexpected resource loadsdefault-src 'self'; object-src 'none'; frame-ancestors 'self'
Strict-Transport-SecurityDowngrade and cookie interception over HTTPmax-age=86400 initially, raised after verification
X-Content-Type-OptionsMIME type sniffingnosniff
Referrer-PolicyLeaking URLs and query stringsstrict-origin-when-cross-origin
Permissions-PolicyUnnecessary browser feature accesscamera=(), microphone=(), geolocation=()
X-Frame-OptionsClickjacking on older browsersSAMEORIGIN (with CSP frame-ancestors)

How should you roll headers out?

  1. STEP 01

    Start with the safe set

    Add X-Content-Type-Options, Referrer-Policy and Permissions-Policy. These rarely break anything.

  2. STEP 02

    Enable HSTS with a short max-age

    Confirm every subdomain and asset works over HTTPS, then raise max-age. Only consider preload once you are certain.

  3. STEP 03

    Run CSP in report-only

    Collect violation reports for a couple of weeks, fix the legitimate ones, then enforce.

  4. STEP 04

    Re-test after every deploy

    New third-party scripts are the most common cause of a CSP that silently gets loosened.

Adding 'unsafe-inline' to script-src removes most of CSP's value. Use nonces or hashes instead.

What headers cannot do

Headers act in the browser. They will not stop server-side injection, credential theft, or a compromised plugin writing to your files. A perfect header grade on a hacked site is still a hacked site — which is why header checks belong alongside file, account and search-side checks rather than replacing them.

Frequently asked questions

Which security headers matter most?
Content-Security-Policy and Strict-Transport-Security provide the most protection. X-Content-Type-Options, Referrer-Policy and Permissions-Policy are quick, low-risk additions.
Can security headers break my site?
A strict Content-Security-Policy can block legitimate third-party scripts, and HSTS makes HTTPS mandatory for the duration of max-age. Both risks are managed by staging: report-only for CSP, a short max-age for HSTS.

Sources

Read next

  • Website Security

    Website Security Checklist

    A prioritised checklist covering access, patching, backups, monitoring and response — ordered by how much risk each control removes.

  • Hub

    Website security hub

    Pillar guides on compromise, injected spam and hardening, by platform and business type.