HTTP Security Headers Guide: Check CSP, HSTS, CORS, and Permissions Policy
HTTP headersweb securityCSPHSTSCORSsecurity testing

HTTP Security Headers Guide: Check CSP, HSTS, CORS, and Permissions Policy

WWebbClass Editorial Team
2026-11-18
7 min read

Learn how to inspect CSP, HSTS, CORS, and other HTTP security headers with browser tools, curl, and a reusable deployment checklist.

HTTP security headers tell browsers how your website should handle scripts, connections, content types, referrers, embedded features, and cross-origin requests. This practical checklist shows how to inspect live headers, understand the role of CSP, HSTS, CORS, and related controls, and document a policy you can verify after each deployment.

Overview

Security headers are response headers sent by a web server or application. They do not replace secure authentication, authorization, input validation, dependency management, or careful application design. They are browser-facing instructions that reduce specific classes of mistakes and limit the damage caused by some common implementation failures.

Start with the headers that match your application rather than copying a scanner’s recommendations without review. A static website, a WordPress installation, a single-page application, and an API may need different values. The correct policy also depends on whether the site embeds third-party content, uses several subdomains, accepts cross-origin requests, or serves authenticated users.

HeaderPrimary purposeWhat to check
Content-Security-PolicyRestricts where scripts, styles, images, frames, connections, and other resources may load from.Review directives, inline code, third-party domains, reporting, and whether the policy breaks required features.
Strict-Transport-SecurityInstructs a browser to use HTTPS for future visits to a host.Confirm HTTPS works everywhere covered by the policy before increasing duration or including subdomains.
X-Content-Type-OptionsHelps prevent MIME-type sniffing when set to nosniff.Check that resources are served with accurate Content-Type values.
Referrer-PolicyControls how much referrer information browsers send with requests.Choose a value that balances analytics and navigation needs with URL privacy.
Permissions-PolicyControls access to browser features such as camera, microphone, and geolocation.List only features the site needs and review embedded frames separately.
CORS headersControl whether a browser permits a page from one origin to read a response from another origin.Check allowed origins, methods, headers, credentials, and preflight responses.

For a broader debugging workflow, pair header checks with request and response inspection. The webhook testing and replay guide is useful when you need to examine payloads, signatures, and HTTP behavior rather than only the final page.

Checklist by scenario

1. Inspect the live website

  1. Open the site in a browser and launch Developer Tools.
  2. In the Network panel, select the document request, then inspect response headers.
  3. Repeat the check for important assets, API responses, redirects, login pages, and error pages. A policy on the HTML document does not automatically describe every response from the site.
  4. Test both HTTP and HTTPS behavior, including the final redirect destination.
  5. Record the URL, status code, response headers, date, and environment you tested.

You can also inspect headers from a terminal. A header-only request is convenient when supported by the server:

curl -I https://example.com

To follow redirects and preserve the response headers for review, use:

curl -sS -D - -o /dev/null -L https://example.com

Use a browser-based HTTP security headers checker as a second view, not as the sole source of truth. Automated tools may miss authenticated routes, JavaScript-generated behavior, environment-specific configuration, or a deliberate exception documented by your team.

2. Review a Content Security Policy

Read the policy as a list of allowed resource destinations. Start by identifying the application’s required scripts, styles, fonts, images, frames, form destinations, and API connections. Common directives include default-src, script-src, style-src, img-src, font-src, connect-src, frame-src, object-src, and frame-ancestors.

A restrictive policy is only useful when it reflects the application’s actual behavior. Avoid adding broad allowances simply to silence errors. Instead, identify the blocked resource, determine whether it is necessary, and decide whether to remove it, self-host it, or document a narrowly scoped exception. Test changes with Content-Security-Policy-Report-Only where appropriate before enforcing them; report-only mode observes violations but does not provide enforcement.

3. Verify HSTS safely

HSTS applies to HTTPS visits and tells a browser to prefer HTTPS for a host for a stated period. Before using a long duration, confirm that the site and every intended subdomain support HTTPS, including administrative interfaces, asset hosts, and legacy services. Treat includeSubDomains as a deliberate infrastructure decision, not a default option. Changes can affect hosts that are not managed by the same team.

4. Check CORS on API routes

CORS is about browser enforcement of cross-origin reads; it is not an access-control system for protecting an API from every client. Verify the exact requesting origin, allowed methods, allowed request headers, exposed response headers, and whether credentials are permitted. Test the preflight request as well as the actual request. A useful companion is the CORS error troubleshooting guide, which covers preflight, credentials, and API request failures.

Never treat an arbitrary reflected origin as an approved policy. If credentials are involved, review the origin and credential combination carefully and confirm that caches vary correctly where necessary.

5. Apply baseline response controls

  • Confirm X-Content-Type-Options: nosniff is compatible with correctly declared resource MIME types.
  • Choose a Referrer-Policy that avoids exposing sensitive path or query information while preserving required navigation behavior.
  • Use Permissions-Policy to disable browser capabilities the application does not need, and inspect iframe permissions separately.
  • Check that security headers survive CDN, reverse proxy, hosting, and application-server layers.

What to double-check

Create a small header-policy worksheet before changing production configuration:

ItemIntended valueExceptions and test routeOwner
TransportHTTPS redirect and HSTS scopeSubdomains, legacy hosts, local developmentInfrastructure
Content sourcesCSP directives and approved originsAnalytics, payments, fonts, embedsFrontend
Cross-origin APIApproved origins, methods, and credentialsDevelopment and staging originsBackend
Browser featuresPermissions Policy allowlistCamera, microphone, maps, or embedded toolsProduct

Check response variations, including authenticated and unauthenticated pages, error responses, file downloads, and API endpoints. A proxy may add one header while the application adds another, producing duplicate or conflicting values. Also check cache behavior: a response cached for one origin or route must not be reused in a way that exposes an inappropriate CORS policy.

Keep the approved worksheet beside deployment configuration. When a scanner reports a missing header, compare the finding with the intended policy, the route tested, and the application’s threat model. This is more reliable than treating every warning as equally urgent.

Common mistakes

  • Copying a policy without mapping dependencies: A copied CSP can block payment widgets, analytics, fonts, or API calls. Inventory dependencies first.
  • Using HSTS before every covered host is ready: HTTPS failures on a subdomain can become difficult for visitors to bypass after a strict policy is cached.
  • Confusing CORS with authentication: CORS controls browser access to responses. It does not replace server-side authorization or API authentication.
  • Testing only the homepage: Headers can differ across routes, redirects, static files, and error pages.
  • Allowing broad wildcards for convenience: Broad source or origin patterns may undermine the restriction you intended. Use the narrowest practical scope.
  • Ignoring deployment layers: CDN rules, web servers, frameworks, plugins, and hosting dashboards can all modify headers. Identify the layer that ultimately sends the response.
  • Changing several controls without a baseline: Record the current behavior, make one related change at a time, and test affected user flows.

For WordPress sites, inspect headers after plugin, theme, cache, and hosting changes rather than assuming a security plugin controls every response. For applications with frequent dependency changes, review third-party scripts and domains as part of the NPM dependency update workflow.

When to revisit

Run this checklist before a major seasonal planning cycle, before launching a new integration, and after changes to hosting or deployment workflows. Recheck headers after a domain migration, subdomain addition, CDN or reverse-proxy change, authentication redesign, CMS update, or introduction of third-party scripts and embedded content.

At minimum, schedule a recurring review that compares live responses with the approved worksheet. During the review:

  1. Capture representative headers with browser tools and curl.
  2. Compare actual values with the documented policy.
  3. Review CSP reports or browser console violations for unexpected resources.
  4. Test CORS preflight and credentialed flows where the API uses them.
  5. Confirm HSTS scope still matches the hosts your team can support.
  6. Record exceptions, owners, test dates, and follow-up actions.

Browser behavior, security specifications, scanner capabilities, and hosting defaults can change. Treat this guide as a repeatable inspection method, then verify current implementation details in the documentation for the browser, framework, CDN, or server you use. The goal is not a permanently frozen header set; it is a documented policy that remains intentional as the website changes.

Related Topics

#HTTP headers#web security#CSP#HSTS#CORS#security testing
W

WebbClass Editorial Team

Developer Tools Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.