HTTP Security Headers Checklist

CSP, HSTS, nosniff, frame protection, referrer policy and permissions policy review. Last updated August 31, 2026.

Security headers turn browser behavior into part of the application security model. MDN explains Content Security Policy as instructions from a site to a browser that restrict what page code may do, especially what resources it may load. See MDN CSP. MDN also documents HSTS and MIME sniffing protection through Strict-Transport-Security and X-Content-Type-Options.

Inspect headers first

curl -I https://example.com/
curl -I https://example.com/app.js
curl -I https://example.com/api/profile

Header checklist

HeaderTypical goalReview warning
Content-Security-PolicyLimit scripts, styles, images, frames and connections.Start in report-only mode for complex apps when possible.
Strict-Transport-SecurityTell browsers to use HTTPS for future requests.Be careful with includeSubDomains and preload if subdomains are not ready.
X-Content-Type-OptionsPrevent MIME sniffing with nosniff.Make sure JS and CSS files have correct content types.
Referrer-PolicyControl how much URL context is sent as referrer.strict-origin-when-cross-origin is a practical default for many sites.
Permissions-PolicyLimit browser features such as camera, microphone and geolocation.Do not allow features the page never uses.
frame-ancestorsControl who can embed the page.Prefer CSP frame-ancestors over legacy-only framing assumptions.

Static site starter policy

Content-Security-Policy: default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()

Nginx example

add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests" always;
add_header Strict-Transport-Security "max-age=31536000" 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=()" always;

Deployment review

Security headers should be reviewed as production behavior. A policy that blocks required scripts is a reliability bug; a policy that allows everything is barely a policy.

Related: HTTP Headers Reference, Nginx Reverse Proxy Checklist, Safe Online Developer Tools, curl API Debugging Cheatsheet.