Security headers checker
Does your page send the headers that protect its visitors in the browser?
- Checks your page
- Reads:Server response
- 5 rules
- Last updated
What we keep
The result appears here
Enter your page’s address and press “Check the page”. This is what the tool runs on it:
- HTTPS without HSTSnot started
- No Content Security Policynot started
- No X-Content-Type-Options: nosniffnot started
- Any site may show the page in a framenot started
- No referrer policynot started
What it checks
Strict-Transport-Security(HSTS) on an HTTPS page, with amax-ageabove zero and written as RFC 6797 asks, so browsers keep to HTTPS.- An enforced Content Security Policy, in the
Content-Security-Policyheader or a<meta http-equiv>in<head>. AContent-Security-Policy-Report-Onlyheader blocks nothing, so it does not count. X-Content-Type-Options: nosniff, so browsers take each response'sContent-Typeas sent instead of guessing it.- Protection from framing, against clickjacking:
frame-ancestorsin the policy header, orX-Frame-OptionsofDENYorSAMEORIGIN. - A referrer policy, in a
Referrer-Policyheader or a<meta name="referrer">. This one is information: browsers already default tostrict-origin-when-cross-origin.
Example
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 X-Frame-Options: ALLOW-FROM https://partner.example/
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Security-Policy: default-src 'self'; frame-ancestors 'self' X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Referrer-Policy: strict-origin-when-cross-origin
How to fix
Add the headers where your server writes its responses. In nginx, in the server block of your HTTPS site:
- In nginx, a
locationblock with anadd_headerof its own does not inherit those of theserverblock, so repeat them there. - In Apache (mod_headers), each header is a
Header always setline, such asHeader always set X-Content-Type-Options "nosniff". - In Cloudflare, a Response Header Transform Rule can set each of them.
- Write the policy for what your pages load:
default-src 'self'suits a site whose files all come from its own domain, with no inline code. Try yours asContent-Security-Policy-Report-Onlyfirst, and read what it would block. includeSubDomainscovers every subdomain: keep it once they all work over HTTPS, or start without it.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self'" always;
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options SAMEORIGIN always;
add_header Referrer-Policy strict-origin-when-cross-origin always;FAQ
Two of them. A Content Security Policy works in <meta http-equiv="Content-Security-Policy"> inside <head>, without frame-ancestors, report-uri and sandbox, and a referrer policy works in <meta name="referrer">. Browsers read HSTS, X-Content-Type-Options and X-Frame-Options from the response's headers alone.
Because browsers already use strict-origin-when-cross-origin when a page sets no policy, which sends other sites the origin alone. The check says so as information, so you can state the policy yourself; before a change to the standard in November 2020, the default sent other sites the full address.
No. The check finds each header and reads it as browsers do, but it does not judge what your Content Security Policy allows, nor which sites frame-ancestors lets frame the page. A policy of default-src * passes, and protects little.
No, it reads the page's own response. Send the same headers on every response: X-Content-Type-Options matters as much on scripts and stylesheets, which browsers refuse with it when their Content-Type is wrong.
What this tool runs
- HTTPS without HSTSmoderate
hsts-missing - No Content Security Policyminor
csp-missing - No X-Content-Type-Options: nosniffminor
x-content-type-options-missing - Any site may show the page in a frameminor
frame-protection-missing - No referrer policyinfo
referrer-policy-missing
How we measure
We fetch the page as ArablyzerBot, follow its redirects, and read the final response's headers and its HTML as the server sends them, before any JavaScript runs. We read each header as browsers do: the policy as Content Security Policy Level 3 parses it, X-Content-Type-Options by its first value as the Fetch standard says, X-Frame-Options as the HTML standard says, Referrer-Policy by the last value browsers know, and Strict-Transport-Security as RFC 6797 writes it. The checks apply to HTML pages that answer with a 2xx status on a public site, and HSTS to HTTPS pages on a host name. The referrer policy is information, never deducted from the score. The same page gives the same result on every check.