- Cost
- Free
- Headers
- 6 graded
Security headers checker
Enter a URL and the checker fetches it, follows its redirects, and grades the security headers on the final response: Strict-Transport-Security, Content-Security-Policy, framing protection, X-Content-Type-Options, Referrer-Policy and Permissions-Policy, plus the flags on any cookies it sets and the headers that give away server versions. Each line says what is wrong and what to send instead.
One request, redirects followed, page body not read. Nothing is stored.
What each header does, and the value to send
Security headers are instructions to the browser. They cost nothing to send, they are set in one place on the server or the CDN, and each one closes a specific kind of attack. Here is what the checker looks for and why.
How to read the result
Each header gets one of four marks. Good means it is present with a value that does its job. To improve means it is present but weakened, for example a Content-Security-Policy that allows inline scripts. Missing means the header is not sent. Note means the header is optional or the browser's default is reasonable, so its absence is not a fault.
The checker reads the response a first-time visitor gets: no cookies, no login, after following redirects. A page behind a login, or a different path on the same site, can send different headers, so check the pages that matter, such as the login page and the checkout.
Strict-Transport-Security (HSTS)
HSTS tells a browser to use HTTPS for this host for max-age seconds, even if somebody types http:// or follows an old link. Browsers ignore the header when it arrives over plain HTTP, so it only counts on the HTTPS response. max-age=0 switches HSTS off. includeSubDomains extends the rule to every subdomain, which is worth doing only once every subdomain really serves HTTPS.
The checker treats a max-age of at least one year (31536000 seconds) as good. That is also the floor for the HSTS preload list, which additionally requires includeSubDomains, the preload directive, a valid certificate and a redirect from HTTP to HTTPS on the same host. A typical value is max-age=31536000; includeSubDomains.
Content-Security-Policy (CSP)
A CSP lists where the page may load scripts, styles, images and frames from, and so limits what an injected script can do. The checker looks at the rule that governs scripts: script-src, or default-src when script-src is absent.
MDN is direct about the two common weaknesses: developers should avoid 'unsafe-inline', because it defeats much of the purpose of a CSP, and should avoid 'unsafe-eval'. The recommended pattern is a nonce or hash for each script, called a strict CSP. A policy sent only as Content-Security-Policy-Report-Only is not enforced; it is the right way to try a policy out, and it protects nothing until it is switched to the enforcing header.
Sources like * or https: in script-src allow scripts from almost anywhere, which leaves little for the policy to stop.
Framing protection
If a page can be loaded inside a frame on another site, it can be overlaid with something that tricks people into clicking it. The frame-ancestors directive in the CSP controls who may embed the page, and MDN advises setting it to 'none' unless the site needs to be embeddable. X-Frame-Options with DENY or SAMEORIGIN does the same job for older setups. Its ALLOW-FROM value is obsolete, and modern browsers ignore the whole header when they see it.
nosniff, Referrer-Policy and Permissions-Policy
X-Content-Type-Options has one valid value, nosniff. It stops the browser guessing a file's type from its content, and blocks a script or stylesheet that arrives with the wrong MIME type.
Referrer-Policy controls how much of the current address is sent to the next site when someone follows a link. Browsers default to strict-origin-when-cross-origin when no policy is set, which is why a missing header is only a note here. unsafe-url sends the full address, path and query string included, to every destination, and MDN warns that it can leak private information. no-referrer-when-downgrade also sends the full address to other HTTPS sites.
Permissions-Policy lets a site say which browser features, such as camera, microphone or geolocation, its pages and embedded frames may use. Turning off what the site never uses is cheap insurance against a third-party script that tries.
Version leaks, X-XSS-Protection and cookies
A Server header with a version number, or an X-Powered-By header, tells anyone which software and version answer. It does not create a hole, but it makes picking a known exploit easier. Most servers can be told to send only the product name or nothing.
X-XSS-Protection is deprecated and not part of any standard. MDN recommends a Content-Security-Policy that disallows inline scripts instead. If the header is there, it is noted, not counted against the site.
For cookies, the checker reports names and flags only, never values. Secure keeps the cookie off plain HTTP. HttpOnly stops scripts on the page reading it, which matters for session cookies. A cookie with SameSite=None must also carry Secure.
Where to set them
Headers belong in one place: the web server, the reverse proxy or the CDN in front of the site, not in each application. A few patterns that cover most setups:
- nginx:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;in the server block, withalwaysso the header is also sent on error pages. - Apache with
mod_headers:Header always set X-Content-Type-Options "nosniff". - A CDN or load balancer: most have a response header rule or transform. Set the headers there when the origin is shared or hard to change.
- Roll out CSP in report-only mode first, read the violation reports for a week or two, then switch to the enforcing header.
What a header check is not
This reads the headers on one response. It is not a vulnerability scan, a penetration test or a malware check, and a perfect score does not mean the application behind the headers is safe. It is a fast way to find the protections a browser is not being asked to apply.
Questions people ask
- Which security headers should every site send?
- Over HTTPS: Strict-Transport-Security with at least a year of max-age, a Content-Security-Policy without 'unsafe-inline' for scripts, frame-ancestors or X-Frame-Options against framing, and X-Content-Type-Options: nosniff. Referrer-Policy and Permissions-Policy are worth adding; the browser default for referrers is already reasonable.
- Is X-Frame-Options still needed if I have frame-ancestors?
- frame-ancestors in a Content-Security-Policy covers the same ground and more, and the checker accepts either. Sending both does no harm and covers clients that do not understand the CSP directive.
- Why does my CSP show as "to improve"?
- Usually because script-src or default-src allows 'unsafe-inline' without a nonce or hash, allows 'unsafe-eval', or allows scripts from any https: source. Each of these lets injected script run, which is what the policy exists to stop.
- Should I add the preload directive to HSTS?
- Only when every subdomain serves HTTPS and will keep doing so. Preloading puts the domain on a list built into browsers, and getting off it again is slow. The requirements are a valid certificate, an HTTP to HTTPS redirect, max-age of at least 31536000, includeSubDomains and preload.
- Do I still need X-XSS-Protection?
- No. MDN marks it deprecated and non-standard, and recommends a Content-Security-Policy that blocks inline scripts instead.
- Is the result stored?
- No. The page is fetched when you ask and the result is returned to you. Cookie values are never read into the result, only their names and flags.
Where each statement comes from
Checked against the sources on .
- MDN, Strict-Transport-Security (developer.mozilla.org)
- IETF, RFC 6797: HTTP Strict Transport Security (rfc-editor.org)
- HSTS preload list submission requirements (hstspreload.org)
- MDN, Content Security Policy (CSP) (developer.mozilla.org)
- MDN, X-Frame-Options (developer.mozilla.org)
- MDN, X-Content-Type-Options (developer.mozilla.org)
- MDN, Referrer-Policy (developer.mozilla.org)
- MDN, Permissions-Policy (developer.mozilla.org)
- MDN, X-XSS-Protection (developer.mozilla.org)
- MDN, Set-Cookie (developer.mozilla.org)
