HTTP security headers are a practical layer of browser protection, but they are easy to weaken during a deployment, domain migration, or CDN change. This checklist explains which headers to review, how to check them, how to introduce a Content Security Policy safely, and what to verify before treating an audit as complete.
Overview
Security headers are instructions sent by a web server to a browser. They can limit where a page loads resources from, reduce information exposed through referrals, prevent certain content-type mistakes, and control access to browser capabilities. They do not replace secure application code, authentication controls, dependency management, or server hardening. They are one part of a broader website security check.
The most useful approach is to review headers by purpose rather than trying to maximize a scanner score. A header that is appropriate for a public marketing site may need different settings on an authenticated application, an API, an embedded widget, or a legacy CMS. Record the intended policy, test it in a representative environment, and confirm the response delivered at the public edge—not only by the origin server.
| Header | Primary purpose | Key review point |
|---|---|---|
| Strict-Transport-Security | Instructs browsers to use HTTPS for a host | Confirm HTTPS works across intended subdomains before broadening the policy. |
| Content-Security-Policy | Restricts scripts, styles, frames, images, connections, and other resources | Start with observed dependencies and avoid broad allowances that defeat the policy. |
| X-Content-Type-Options | Reduces MIME-type guessing | Use nosniff and ensure resources have correct content types. |
| Referrer-Policy | Controls how much referrer information leaves a page | Choose a setting that balances analytics needs with privacy. |
| Permissions-Policy | Limits access to selected browser features | Allow only features and origins the application actually needs. |
| Frame-ancestors | Controls which sites may embed a page | Set through CSP where supported; check legitimate framing requirements. |
Checklist by scenario
For every public website
- Confirm HTTPS first. Check that HTTP redirects to the intended HTTPS URL and that assets, forms, canonical links, and redirects do not send users back to HTTP.
- Review HSTS. A typical starting value is
Strict-Transport-Security: max-age=31536000, but the duration should match your operational confidence. AddincludeSubDomainsonly when every relevant subdomain supports HTTPS. Treat preload-related settings as a separate decision, not a default toggle. - Set X-Content-Type-Options. Use
X-Content-Type-Options: nosniff. Then check that JavaScript, CSS, fonts, images, downloads, and API responses are served with suitable MIME types. - Choose a Referrer-Policy. A privacy-conscious default such as
strict-origin-when-cross-originmay be suitable for many sites, but test analytics, payment flows, and third-party integrations before standardizing it. - Define Permissions-Policy deliberately. Disable features that the site does not use, and document any required access to camera, microphone, geolocation, fullscreen, or related capabilities.
For applications with user accounts
- Build a Content Security Policy inventory. List scripts, styles, fonts, images, frames, form destinations, WebSocket endpoints, and API connections used by each major route.
- Prefer narrow sources. Avoid
*, unnecessarydata:orblob:sources, and broad script allowances. Be especially cautious with'unsafe-inline'and'unsafe-eval'; they may be required by older components, but they should be treated as migration exceptions. - Protect framing and form destinations. Use
frame-ancestorsto limit who can embed authenticated pages, and useform-actionto restrict where forms may submit. - Consider object restrictions. If the application has no need for legacy plug-in content,
object-src 'none'can remove an unnecessary resource type.
For APIs and non-HTML responses
- Confirm that security headers are present on error responses as well as successful responses.
- Check CORS separately. Security headers do not replace correct
Access-Control-Allow-Origin, credentials, or preflight handling. - Verify content types and prevent browsers from interpreting an API response as a different type.
- Do not copy a browser-page CSP mechanically onto an API. Define controls based on how clients consume the endpoint.
For a CDN, reverse proxy, or platform migration
- Compare headers from the origin with headers from the public hostname.
- Check whether the edge removes, duplicates, or rewrites headers.
- Test cached and uncached responses, redirects, custom error pages, and alternate hostnames.
- Confirm that staging and production do not silently inherit different policies.
What to double-check
A reliable security headers audit combines an automated check with manual testing. From a terminal, inspect the final response and follow redirects when appropriate:
curl -I https://example.com
curl -sS -D - -o /dev/null https://example.com/loginReview the browser’s developer tools as well. The Console commonly identifies blocked scripts, styles, frames, fonts, or connections after a CSP change. The Network panel shows the actual response headers, redirect chain, status code, content type, and whether a request was served by a cache.
For CSP, begin with a reporting or observation approach where practical, then move toward enforcement after examining legitimate violations. A policy might eventually resemble:
Content-Security-Policy: default-src 'self'; script-src 'self' https://cdn.example; style-src 'self'; img-src 'self' https: data:; connect-src 'self' https://api.example; object-src 'none'; frame-ancestors 'none'; form-action 'self'This is an example pattern, not a copy-and-paste universal policy. Replace domains with verified dependencies, remove sources that are not required, and test login, checkout, uploads, embedded media, single-page navigation, and error pages. A CSP report does not prove that an attack occurred; it can also reveal a broken integration, browser extension, stale code, or a misconfigured asset.
Also check policy scope. HSTS applies to a host and can affect subdomains when configured to do so. CSP can differ by route or response. Permissions-Policy may be inherited through frames. A header present on the homepage but missing on an authenticated route is not a complete deployment.
Common mistakes
- Turning on HSTS without an inventory. Forgotten subdomains, development hosts, or HTTP-only services can become inaccessible when a broader policy is applied.
- Treating a scanner grade as the objective. A high score does not prove that authentication, session cookies, access control, or application logic are secure.
- Using a permissive CSP to silence errors. Adding broad domains or unsafe directives may make warnings disappear while leaving the intended protection weak.
- Testing only the homepage. Login, administration, checkout, file handling, embedded content, APIs, and error responses often have different dependencies.
- Setting headers in the wrong layer. A web server may set a header that a CDN later replaces, or a framework may add a duplicate value that browsers interpret unexpectedly.
- Confusing cookies with headers. Secure, HttpOnly, and SameSite are cookie attributes, not substitutes for CSP, HSTS, or other response policies. Review them in the same deployment audit, but test them separately.
- Ignoring redirects and cached responses. Users receive the final public response, which may not match the configuration file or origin response inspected by an administrator.
When to revisit
Run this checklist before each production deployment that changes domains, routes, scripts, frameworks, authentication, embedded services, CDN settings, or server configuration. Revisit it after a security scan, a major browser or platform change, a CMS or dependency update, and any incident involving a malicious link, injected script, or unexpected third-party resource.
Maintain a small header record alongside the application: the intended value, the configuration layer that owns it, required exceptions, test URLs, and the person or team responsible for approval. During recurring maintenance, compare the current public response with that record rather than assuming configuration has remained unchanged.
For a practical final pass, check the production hostname with curl, inspect representative pages in a browser, review console violations, test redirects and error responses, and confirm that legitimate integrations still work. Save the results with the deployment notes. This turns a one-time website security header check into a repeatable control that can be applied after the next release, migration, or security alert.