HTTP security headers checklist: what to send and how to test
The HTTP security headers worth sending in 2026, with OWASP-recommended values, nginx and Helmet configuration, a safe CSP rollout and free ways to test them.
Updated 7 min read

In this article
Part 6 of 8
A developer's reference kit
All partsHide
Part 6 of 8
A developer's reference kit
Where to learn, then the cheat sheets and checklists worth keeping open while you work.
HTTP security headers checklist: what to send and how to test
You are here · 7 min read
HTTP security headers are a few lines of server configuration that tell browsers to refuse framing, stop guessing content types, insist on HTTPS and limit where scripts can load from. They cost almost nothing to add and are among the first things a security review or penetration test looks at.
An HTTP security headers checklist tells you which headers to send and with which values. The recommendations here follow the OWASP HTTP Headers Cheat Sheet, with configuration for nginx and Helmet on Node.js and free tools to test the result.
This checklist gives you the headers worth sending in October 2026, the values recommended by the OWASP HTTP Headers Cheat Sheet, copy-ready configuration for nginx and Node.js, and free tools to test the result. It is aimed at developers and small teams running their own servers or apps; each item has a short "why" so you can decide rather than copy blindly.
The HTTP security headers checklist at a glance
| Header | Recommended starting value | What it protects against |
|---|---|---|
Strict-Transport-Security | max-age=63072000; includeSubDomains (add preload only deliberately) | Downgrade to plain HTTP, cookie theft on insecure connections |
Content-Security-Policy | A policy built for your site, starting in report-only mode | Cross-site scripting and injected third-party code |
X-Content-Type-Options | nosniff | Browsers treating uploaded files as scripts or styles |
X-Frame-Options / CSP frame-ancestors | DENY or frame-ancestors 'none' | Clickjacking |
Referrer-Policy | strict-origin-when-cross-origin | Leaking full URLs (and tokens in them) to other sites |
Permissions-Policy | geolocation=(), camera=(), microphone=() | Embedded code using powerful browser features |
Cross-Origin-Opener-Policy | same-origin | Cross-window attacks from pages you open or that open you |
Cross-Origin-Resource-Policy | same-site or same-origin | Other sites embedding your resources |
X-XSS-Protection | 0 (or omit) | Disables a legacy browser filter that caused its own vulnerabilities |
Server, X-Powered-By | Remove, or make non-informative | Advertising your stack and versions |
The headers, one by one
Strict-Transport-Security (HSTS)
HSTS tells a browser to use HTTPS for your domain for max-age seconds, even if a user types http://. The OWASP cheat sheet recommends max-age=63072000; includeSubDomains; preload, and warns you to understand the header before using it. includeSubDomains breaks any subdomain still served over plain HTTP, so check internal tools and old marketing subdomains first.
About preload: the HSTS preload list builds your domain into browsers. Its requirements are a redirect from HTTP to HTTPS on the same host, a max-age of at least 31536000 seconds (one year), and both includeSubDomains and preload. The site warns that inclusion "cannot easily be undone" and that removal takes months to reach users through browser updates. Start without preload, run with a long max-age for a while, then submit when you are sure.
Content-Security-Policy (CSP)
CSP is the most powerful header on this list and the only one that needs real design. It lists where scripts, styles, images, frames and connections may come from; anything else is blocked. OWASP calls it "complex to configure and maintain" and has a separate CSP Cheat Sheet.
Roll it out safely with Content-Security-Policy-Report-Only. MDN describes this header as monitoring violations without enforcing the policy, so you can see what would break. Reports go to an endpoint named in Reporting-Endpoints through the report-to directive; MDN notes that report-uri is deprecated but still commonly sent alongside report-to because support for the newer directive is not yet universal.
Reporting-Endpoints: csp-endpoint="https://example.com/csp-reports"
Content-Security-Policy-Report-Only: default-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; report-uri /csp-reports; report-to csp-endpointWatch the reports for a week or two, adjust the policy, then switch the header name to Content-Security-Policy. Note that the report-only header is not supported in a <meta> element; it must be an HTTP response header.
X-Content-Type-Options, X-Frame-Options and Referrer-Policy
X-Content-Type-Options: nosniffstops browsers from second-guessing theContent-Typeyou send. Pair it with correct content types everywhere, especially for user uploads.X-Frame-Options: DENYprevents your pages from being framed by other sites. OWASP suggests the CSPframe-ancestorsdirective where possible; sending both is harmless. UseSAMEORIGINorframe-ancestors 'self'if you frame your own pages.Referrer-Policy: strict-origin-when-cross-originsends only your origin to other sites, never the full path or query string. OWASP recommends setting it explicitly rather than relying on browser defaults.
Permissions-Policy and the cross-origin headers
Permissions-Policy switches off browser features you do not use, so a compromised third-party script cannot ask for the camera or location. The OWASP example geolocation=(), camera=(), microphone=() disables those three for every origin. Cross-Origin-Opener-Policy: same-origin isolates your browsing context from windows on other origins, and Cross-Origin-Resource-Policy limits who can embed your resources. Cross-Origin-Embedder-Policy: require-corp is only needed if you want cross-origin isolation (for example for SharedArrayBuffer), and OWASP notes it can block misconfigured cross-origin resources, so leave it out unless you need it.
Headers to turn off or remove
OWASP recommends X-XSS-Protection: 0 or not setting it at all; the old browser filter it controlled is gone from modern browsers and could itself be abused. It also recommends removing X-Powered-By and removing or blanking Server. Helmet's documentation is honest that hiding X-Powered-By offers very limited security benefit, but it costs nothing.
Copy-ready configuration
nginx
Two nginx details catch almost everyone. First, add_header only applies to certain success and redirect status codes unless you add the always parameter, so without it your 404 and 500 pages are unprotected. Second, add_header directives are inherited from the enclosing level only if the current level defines none of its own: one add_header inside a location block silently drops all the server-level ones. nginx 1.29.3 added add_header_inherit merge; to change that; on older versions, repeat the headers or keep them in an included file.
# /etc/nginx/snippets/security-headers.conf
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), camera=(), microphone=()" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Content-Security-Policy-Report-Only "default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" always;
# in each server { } block (and any location that has its own add_header):
# include snippets/security-headers.conf;
server_tokens off; # removes the nginx version from the Server headerNode.js with Express and Helmet
Helmet (version 8.3.0 on npm in October 2026) sets 13 headers with one line, including a sensible default CSP, X-XSS-Protection: 0 and removal of X-Powered-By. Its defaults differ slightly from OWASP's: for example X-Frame-Options: SAMEORIGIN, Referrer-Policy: no-referrer and HSTS of one year without preload. Override what you need:
import express from 'express';
import helmet from 'helmet';
const app = express();
app.use(helmet({
contentSecurityPolicy: {
directives: {
'script-src': ["'self'"],
'img-src': ["'self'", 'data:', 'https://images.example.com'],
},
},
strictTransportSecurity: { maxAge: 63072000, includeSubDomains: true },
referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
}));We ran this with Express 5 and Helmet 8.3.0 on Node.js 24: the response carried the custom CSP merged with Helmet's defaults, the chosen HSTS and referrer policy, and no X-Powered-By header.
PHP applications and hosted platforms
For PHP sites behind nginx or Apache, set headers in the web server so they also cover static files. If you deploy to a platform, use its own mechanism: Vercel's headers setting in vercel.json or Cloudflare response header transform rules can add the same values at the edge.
How to test your headers for free
curl: see exactly what is sent
# Headers on the home page
curl -sI https://example.com/
# Headers on an error page (checks nginx's "always")
curl -sI https://example.com/this-page-does-not-existMDN HTTP Observatory
The HTTP Observatory on MDN grades a site's headers and related settings. Every site starts at 100, penalties are subtracted, and bonus points are added only if the result is still 90 or more, up to a maximum of 145. It replaced the older Mozilla Observatory, which was sunset in October 2024. There is also a JSON API; its FAQ says a site can be rescanned at most once every 60 seconds:
curl -s -X POST "https://observatory-api.mdn.mozilla.net/api/v2/scan?host=example.com"When we ran it for developer.mozilla.org on 9 October 2026 the response reported grade A+, score 110, and 12 of 12 tests passed. Put the API call in CI and fail the build if the grade drops.
What to do next
- Run
curl -sIagainst your home page and a 404 page, and note which headers are missing. - Add the low-risk headers first:
X-Content-Type-Options,X-Frame-Options,Referrer-Policy,Permissions-Policyand HSTS withoutpreload. - Deploy CSP in report-only mode, collect reports, tighten, then enforce.
- Scan with the HTTP Observatory and record the grade in your release checklist.
- Revisit after adding any third-party script, analytics tool or embed, because each one changes what your CSP must allow.
Security headers will not fix vulnerable code, but they shrink what an attacker can do with a mistake. An afternoon of configuration buys protection on every page you serve.
Frequently asked questions
Which security header should I add first?
Start with the low-risk ones:
X-Content-Type-Options: nosniff,X-Frame-Options,Referrer-Policyand HSTS withoutpreload. Then roll out CSP in report-only mode.Should I submit my domain to the HSTS preload list?
Only when every subdomain works over HTTPS and you are sure. hstspreload.org warns that inclusion cannot easily be undone and removal takes months to reach users.
Is X-XSS-Protection still useful?
No. OWASP recommends
X-XSS-Protection: 0or omitting it, and relying on a Content Security Policy instead.Why are my nginx headers missing on error pages?
Without the
alwaysparameter, nginx only adds headers to certain success and redirect responses. Addalwaysto eachadd_header.Why did my headers disappear in one location block?
nginx inherits
add_headerdirectives only if the current level defines none. Repeat them, include a shared snippet, or useadd_header_inherit merge;on nginx 1.29.3 or later.Is the MDN HTTP Observatory the same as the old Mozilla Observatory?
It is its successor. The old Observatory was sunset in October 2024; the MDN version focuses on HTTP data and keeps historic scan results.
Sources
- HTTP Security Response Headers Cheat Sheet — OWASP
- HTTP Observatory FAQ — MDN
- HTTP Observatory tests and scoring — MDN
- HSTS Preload List Submission — hstspreload.org (Chromium)
- Content-Security-Policy-Report-Only — MDN
- Module ngx_http_headers_module — nginx
- Helmet README — Helmet
Part 7 of 8: A developer's reference kit
Next part
Previous part
Resource guideResources8 min read
Free accessibility testing tools and a 30-minute WCAG 2.2 check
The free, maintained accessibility tools worth installing in 2026, from WAVE and axe to NVDA, plus a 30-minute WCAG 2.2 release check and an axe-core script.
New tools, once a week
One short email listing what joined the directory.
Comments
No comments yet. Be the first to join the conversation.
Leave a comment
Every comment is read by a moderator before it appears. Your email address is never published; it is used only to contact you about this comment.
More from Cloudsoft Zone

TutorialDevOps5 min read
GitLab CI/CD for Laravel: test, build and deploy a reviewed release to a VPS
Design GitLab CI/CD for Laravel with a reviewed PHP image, disposable MySQL checks, explicit artifacts, protected credentials and serialized VPS deployments.
By Nilesh Kushvaha

TutorialDevOps5 min read
Laravel CI/CD with GitHub Actions: verification, release artifacts and guarded deployment
Build Laravel CI/CD with GitHub Actions using locked dependencies, isolated verification, immutable release artifacts and a protected deployment job with explicit recovery gates.
By Nilesh Kushvaha

TutorialDevOps5 min read
Prometheus and Grafana monitoring for Laravel and Node.js applications
Use Prometheus and Grafana to connect private application metrics, host observations and actionable dashboards for Laravel and Node.js production workloads.
By Nilesh Kushvaha

TutorialDevOps5 min read
Production stack monitoring: nginx, PHP-FPM, MySQL, Redis and queue workers
Build production stack monitoring with private nginx and PHP-FPM status, MySQL connection signals, Redis memory context and queue progress instead of process-only checks.
By Nilesh Kushvaha