Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
HTTP security headers are response headers that instruct the browser to enforce restrictions on a page, from transport and framing to script sources and referrer leakage.

What Are HTTP Security Headers?
HTTP security headers are instructions a server attaches to a response so the browser applies restrictions the page itself cannot enforce. They are cheap to deploy and they work entirely on the client, which makes them the most reliable defence-in-depth layer available to a web application and also the easiest to get wrong, because a header with a syntax error is silently ignored.
| Header | Purpose | Sensible value |
|---|---|---|
| Content-Security-Policy | Controls which scripts, styles, and connections are permitted | Nonce-based policy with object-src 'none' |
| Strict-Transport-Security | Forces HTTPS for the host | max-age=31536000; includeSubDomains |
| X-Content-Type-Options | Stops the browser guessing a media type | nosniff |
| Referrer-Policy | Limits what is leaked in the Referer header | strict-origin-when-cross-origin |
| Permissions-Policy | Switches off device APIs the page does not use | camera=(), microphone=(), geolocation=() |
| Cross-Origin-Opener-Policy | Severs the window reference to cross-origin openers | same-origin |
| Cross-Origin-Resource-Policy | Prevents other sites embedding your resources | same-origin |
| Cache-Control | Keeps authenticated responses out of shared caches | no-store on private pages |
Content Security Policy and HSTS carry most of the value and each deserves its own treatment, because both need planning rather than a copied line of configuration.
X-Content-Type-Options: nosniff matters more than its brevity suggests. Without it, some browsers inspect the body of a response and may treat a text file as HTML, which turns a benign upload or an error page into script execution. It also stops a stylesheet or script being loaded when its declared type does not match.
Referrer-Policy addresses a quiet leak. A page at /reset-password?token=abc that links out to a third party sends the full URL, token included, in the Referer header. The recommended value sends the origin only on cross-origin navigations and nothing at all when moving from HTTPS to HTTP.
Permissions-Policy, which replaced Feature-Policy, lets a page disclaim capabilities it does not need, so an injected script or a compromised iframe cannot reach the camera, microphone, or payment request API.
The cross-origin set, Cross-Origin-Opener-Policy, Cross-Origin-Embedder-Policy, and Cross-Origin-Resource-Policy, was introduced in response to Spectre-class attacks. Together they place a document in its own browsing context group, which both mitigates side-channel reads and enables high-resolution timers for applications that need them.
X-Frame-Options is superseded by the frame-ancestors directive, which supports multiple origins properly. Keep it only while you still support browsers that predate CSP Level 2.X-XSS-Protection controlled a browser filter that has been removed from Chrome, Edge, and Safari. The filter itself introduced vulnerabilities, and the correct value today is 0 or no header at all.Public-Key-Pins is deprecated and removed. Pinning errors bricked sites, and Certificate Transparency monitoring replaced it.Expect-CT is obsolete now that Certificate Transparency is enforced by default.Set headers in one place, usually the reverse proxy or a middleware layer, so every response carries them, including error pages, redirects, API responses, and static files. Headers applied only to the main document leave those paths uncovered, and an attacker will find the uncovered path. Where a framework sets defaults, such as Helmet for Express or SecurityHeaders middleware in ASP.NET Core, read what it actually emits rather than trusting the description.
Verification should use real traffic. securityheaders.com and the Mozilla Observatory grade a single URL quickly; a crawl of your own site comparing headers across content types finds the gaps those tools miss. Remember that these headers constrain the browser and have no effect on a non-browser client, so they supplement server-side controls such as input validation and output encoding rather than standing in for them. Our web application security testing reviews the header set across every response type as part of the assessment.
Start with X-Content-Type-Options, Referrer-Policy, and the frame-ancestors restriction, because all three are low risk and can usually be deployed in an afternoon. Strict-Transport-Security comes next, introduced with a short max-age. Content Security Policy is last and takes the most effort, since it requires inventorying every script the application loads.
Most will not. The ones that can are Content Security Policy, which blocks resources the application legitimately uses if the policy is incomplete, and HSTS with includeSubDomains, which makes any subdomain without valid HTTPS unreachable. Deploy the first in report-only mode and the second only after auditing every subdomain.
Only partially, because they are browser instructions and most API clients are not browsers. X-Content-Type-Options, Cache-Control with no-store, and Cross-Origin-Resource-Policy are still worth setting on API responses, since browsers do consume them from JavaScript. Authentication, authorisation, and rate limiting remain the controls that matter for an API.
No. Those tools check one URL for the presence of headers, not whether the policies are meaningful. A Content Security Policy containing unsafe-inline scores well and protects almost nothing, and a header set on the home page may be absent from the login endpoint. Treat the grade as a starting point for review.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.