Security headers are missing
- Check
http.security_headers- Severity
- low
- Runs
- on our side, against a domain you verified
- Looks at
- Content-Security-Policy, X-Content-Type-Options, frame-ancestors or X-Frame-Options, Referrer-Policy
What the check looks at
Once a day the service requests the home page of the domain over HTTPS and looks for four protections:
- a
Content-Security-Policyheader; X-Content-Type-Options: nosniff;- protection against framing:
frame-ancestorsin the CSP, or anX-Frame-Optionsheader; - a
Referrer-Policyheader.
The finding lists which ones are missing.
Why it matters
- Content-Security-Policy limits where scripts and other resources may load from. If an attacker manages to inject HTML (cross-site scripting, the first entry of the 2025 CWE Top 25), a strict policy stops the injected script from running.
- Frame protection stops other sites from loading your pages in an invisible frame and tricking users into clicking buttons on them (clickjacking).
- X-Content-Type-Options: nosniff stops browsers from treating an uploaded text file as a script or stylesheet.
- Referrer-Policy controls how much of your URLs other sites see when users follow links; URLs can carry tokens or search terms.
None of them fixes a bug in your application. They limit what a bug can do.
How to fix it
Start with these values and loosen only what your site needs:
nginx:
add_header Content-Security-Policy "default-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;
Apache httpd (with mod_headers):
Header always set Content-Security-Policy "default-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Caddy:
header {
Content-Security-Policy "default-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
}
The CSP is the one that can break pages: external fonts, analytics, maps or payment forms need their origins listed. Send it first as Content-Security-Policy-Report-Only, browse the site with the developer console open, add the origins it reports, then switch to the enforcing header. If you need to frame your own pages, use frame-ancestors 'self'.
How to check the fix
curl -sI https://example.com/ | grep -i -E 'content-security-policy|x-content-type-options|x-frame-options|referrer-policy'
Then open the site in a browser and watch the console for CSP errors.
When a warning is fine
- An API that only returns JSON: CSP and frame protection matter little there,
nosniffstill does. A minimalContent-Security-Policy: default-src 'none'; frame-ancestors 'none'on API responses is cheap. - A page meant to be embedded by others (a widget): set
frame-ancestorsto the sites allowed to embed it instead of leaving framing open to all.
Sources
- Content Security Policy Level 3, W3C (directives, report-only, frame-ancestors)
- MDN: X-Content-Type-Options, Referrer-Policy, X-Frame-Options
- 2025 CWE Top 25 (CWE-79 ranked first)
- Header settings tested with nginx 1.26.3, Apache 2.4.71 and Caddy 2.6.2 on Debian on 2026-11-26