Some security headers need only a small configuration change; others, especially CSP, need testing against the application. Start by checking which headers the live site sends and what their values allow.

Content-Security-Policy (CSP): the header that stops XSS from mattering

CSP tells the browser which sources may supply scripts, styles, images, and frames. A restrictive policy can stop some injected scripts from running. It complements fixes to unsafe input handling and compromised dependencies; its protection depends on the policy you enforce.

A solid starting policy restricts every resource type to your own domain by default, explicitly allows scripts only from origins you trust, and blocks plugin-based content entirely. The most common mistake isn't a missing CSP, it's a CSP that allows inline scripts or dynamic code evaluation, which defeats most of the protection by letting injected scripts run anyway. If your site depends on inline scripts, use a nonce or hash-based approach instead of a blanket allowance. Most teams start by deploying the policy in report-only mode to see what would break before enforcing it in production.

Strict-Transport-Security (HSTS): closing the downgrade window

HTTPS alone doesn't protect the first request. Without HSTS, a browser's very first connection to your domain can still be made over plain HTTP, and that opens a window for a downgrade attack or session hijacking on an untrusted network. HSTS tells the browser to skip HTTP entirely and go straight to HTTPS for every future visit, no exceptions, for as long as the policy's max age specifies.

Plan the HSTS lifetime and subdomain coverage against the services you operate. Before applying a long policy across subdomains or requesting preload, confirm those services support HTTPS and understand the commitment. Preload can protect a first visit without relying on an earlier HSTS response.

X-Frame-Options and frame-ancestors: shutting down clickjacking

Without framing restrictions, another site may load your page in an iframe. An attacker can conceal that frame beneath misleading controls and trick a user into clicking a password-change, transfer, or permission action. Review where your application permits framing.

X-Frame-Options is the legacy header, still worth setting for older browser support, but the frame-ancestors directive inside CSP is the modern replacement and takes precedence where supported. Deny framing entirely unless you have a specific, known reason to allow it from a particular origin, in which case name that origin explicitly rather than leaving the policy open to anyone.

X-Content-Type-Options: stopping MIME sniffing

MIME sniffing happens when a browser interprets content beyond its declared type. Set X-Content-Type-Options: nosniff to restrict that behavior, and send the correct Content-Type for your responses. Check uploaded files and script resources in particular.

Referrer-Policy: controlling what leaks in the URL

An outbound request may carry information from your page’s URL in the Referer header. Set an explicit policy for how much should be sent across origins. Avoid putting tokens or other sensitive values in URLs, since browser history and logs can retain them too.

The safest practical default sends your full URL on same-origin requests, but trims to just the domain on cross-origin requests, and drops the referrer entirely when a connection downgrades from HTTPS to HTTP.

Permissions-Policy: locking down browser APIs you don't use

Permissions-Policy controls whether the page and embedded content can use supported browser features such as the camera, microphone, geolocation, USB, and payment APIs. Restrict features your site does not need and review the permissions granted to embedded content.

If the site uses one of these features, limit it to the origins that need it. Test the result in the browsers your customers use.

Finding out what's missing

Check the headers on the live site after configuration changes and deployments. Ceron Check can inspect a public URL and report on headers, cookie flags, CORS, and redirects, with evidence and suggested fixes ordered by severity. It is free and requires no login.

After configuring the headers

Configure these headers, test the affected pages, and check the live responses again. This addresses browser-facing protections while leaving account permissions, input handling, and other application behavior to be assessed separately.

Back to the blogExplore Ceron