What headers can and cannot do
Security headers are instructions to the browser. They can reduce the impact of some classes of bug — script injection, clickjacking, content-type confusion, referrer leakage. They cannot fix an authorization flaw, a leaked key, or a server that trusts the wrong input.
Think of them as seatbelts, not brakes.
The ones worth enforcing
Content-Security-Policy
A CSP tells the browser where scripts, styles, frames and connections may come from. A strict policy is the strongest browser-side mitigation against injected script. It is also the header most likely to break a site if added carelessly. Start in report-only mode, watch the violations, then enforce.
Watch for unsafe-inline and unsafe-eval. They are sometimes necessary for legacy code, but they remove much of the protection.
Strict-Transport-Security
HSTS tells the browser to use HTTPS for future requests to this host. Use a long max-age, and only add includeSubDomains when you are sure every subdomain supports HTTPS. HSTS is difficult to undo quickly; deploy it deliberately.
X-Content-Type-Options
nosniff stops browsers from guessing a content type. It is simple, low-risk and worth setting everywhere.
Referrer-Policy
Controls how much URL information is sent to other origins. strict-origin-when-cross-origin is a sensible default for many sites; no-referrer is stricter but can break analytics or partner flows.
Framing protection
X-Frame-Options: DENY or SAMEORIGIN prevents your site from being embedded by another origin. A CSP frame-ancestors directive is the modern equivalent and can be more precise. Use one; you do not need both.
Permissions-Policy
Limits access to browser features such as camera, microphone and geolocation. If your app does not need a feature, say so. It reduces the blast radius of a compromised third-party script.
Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy
These headers control window isolation and who may embed your resources. They matter more as your app starts mixing third-party content. same-origin is a common starting point for COOP; CORP depends on whether you intentionally serve assets cross-origin.
How to check
Use curl -I https://your-site or the network panel in your browser, then read the response headers. The security header review on this site parses pasted headers locally and explains what is missing. It does not make a request to your site.
Common mistakes
- Adding a CSP with
unsafe-inlineand calling it done. - Setting HSTS on a domain that still has HTTP-only subdomains.
- Assuming a header replaces authorization checks.
- Copying a policy from a different app without checking its assets and APIs.
- Forgetting that headers on the HTML document do not automatically apply to every API response.
A passing header check is a useful signal. It is not a security review, and it says nothing about the code behind the page.
Want this read for you?
Appmint reviews shipped apps, code and AI-generated features. Tell us what you're building and we'll suggest the smallest useful next step.
Start a review