Skip to content

HTTP security headers — the set that's actually defensible in 2026

Which HTTP security headers are worth setting in 2026, which ones are deprecated theatre, and how to verify the policy reaches every response.

The list of “essential” HTTP security headers has shifted enough in the last few years that a 2022 hardening guide will leave you with deprecated headers, conflicting policies, and a Content-Security-Policy nobody trusts enough to enforce. Here’s the set we actually ship in 2026, and what we deliberately don’t.

What’s happening

Three headers that used to be on every checklist — X-XSS-Protection, Expect-CT, and Public-Key-Pins — are now either ignored or actively discouraged. Meanwhile, the headers that matter most depend on what the application does: a server that issues cookies and serves authenticated content needs a different baseline than a static marketing site behind a CDN. The default WordPress or Nginx config sets none of them.

How to verify

Check what the server is actually returning, including for both root and an authenticated path:

curl -sIL https://example.com/ | grep -iE 'strict-transport|content-security|x-content-type|x-frame|referrer|permissions|cross-origin'
curl -sIL https://example.com/wp-admin/ | grep -iE 'strict-transport|content-security|x-content-type|x-frame|referrer|permissions'

Then validate the CSP against real page loads with the browser DevTools console open, or run the policy in report-only mode for a week before enforcing.

The fix

The defensible 2026 set, expressed for Nginx:

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'nonce-$cspNonce'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Cross-Origin-Resource-Policy "same-origin" always;

Four notes:

  1. X-Frame-Options: DENY is now covered by frame-ancestors 'none' in CSP. Keep both only if you still serve clients on browsers from 2019.
  2. unsafe-inline for styles is a compromise — WordPress themes and most page builders still inline styles. Removing it is a project, not a flip.
  3. Use a per-request nonce for inline scripts. A static nonce or 'unsafe-inline' for scripts defeats the point of having CSP at all.
  4. always matters. Without it, headers won’t be sent on error responses, which is where attackers often find the easiest exploits.

Roll out CSP in Content-Security-Policy-Report-Only mode first, collect a week of report-uri data, then enforce. Anything else means rolling back during a launch window.

Long-term, header policy belongs in the same change pipeline as application config — that’s part of how we operate environments under Environment Management.