Security response headers are instructions your server sends with every response that tell the browser how to behave more safely. They are one of the highest-value, lowest-cost hardening steps available: no new infrastructure, no code rewrite, just correctly configured headers. They do not fix an insecure application, but they meaningfully reduce the blast radius of common attacks like cross-site scripting and clickjacking.
The headers that matter most
Focus on these first — they cover the majority of the risk:
- Strict-Transport-Security (HSTS) — forces browsers to use HTTPS for your domain, preventing downgrade and cookie-hijacking attacks.
- Content-Security-Policy (CSP) — controls which sources of scripts, styles and other content the browser will load; the strongest defense against cross-site scripting (XSS).
- X-Content-Type-Options: nosniff — stops the browser from second-guessing content types, which can turn a benign upload into executable script.
- X-Frame-Options or CSP frame-ancestors — prevents your pages being embedded in a hostile iframe (clickjacking).
- Referrer-Policy — limits how much URL information leaks to other sites in the Referer header.
- Permissions-Policy — disables browser features you do not use (camera, microphone, geolocation).
Sensible starting values
Reasonable defaults you can adapt — treat CSP as the one that needs real tuning:
- Strict-Transport-Security: max-age=31536000; includeSubDomains (only once HTTPS is solid everywhere).
- X-Content-Type-Options: nosniff
- X-Frame-Options: SAMEORIGIN (or a CSP frame-ancestors 'self' directive, which supersedes it).
- Referrer-Policy: strict-origin-when-cross-origin
- Content-Security-Policy: start restrictive (default-src 'self') and expand only to the specific sources your site genuinely needs.
Need help implementing this?
Our certified engineers can assess your environment and build the right solution — free initial assessment, fixed-quote pricing.
Rolling out CSP without breaking your site
CSP is the most powerful header and the easiest to get wrong — a too-strict policy blocks your own scripts and breaks the page. Deploy it carefully:
- Start with Content-Security-Policy-Report-Only, which reports violations without enforcing them.
- Collect violation reports for a representative period to discover every legitimate source your site uses.
- Tighten the policy to allow exactly those sources — prefer nonces or hashes over 'unsafe-inline' for scripts.
- Switch from Report-Only to enforcing once the reports are clean.
- Avoid 'unsafe-inline' and wildcard sources — they defeat much of CSP's purpose.
What headers do NOT do
It is important to be honest about their limits. A missing header is not, by itself, a vulnerability — it is a missing layer of defense. Conversely, a full set of headers does not make an insecure application secure: they do nothing about SQL injection, broken authentication, or business-logic flaws. Treat headers as one layer in defense-in-depth, alongside secure coding, patching and monitoring.
Check your headers
The fastest way to see which headers your site sends and which are missing — with the reason each one matters — is our free Website Security Checker. It reports a missing header as 'Not detected' with guidance, never as a confirmed exploit. Pair it with the SSL/TLS Deep Analyzer to confirm HSTS and your certificate are configured correctly.
Free tools for this topic
Check your own setup in under a minute
Need Help Implementing This?
Our certified engineers can assess your environment and implement the right solution for your business.
Related Services