HTTP Security Headers
Grade security headers such as HSTS, CSP and X-Frame-Options; see what is missing and what leaks server details.
What do security headers do?
A few lines the server sends with every response tell the browser how to protect the page. Without touching your code they shut down a large part of clickjacking (your page loaded in an invisible frame on another site), XSS script injection, downgrade to unencrypted connections and MIME type confusion.
How is the grade calculated?
Strict-Transport-Security and Content-Security-Policy carry the most weight, followed by X-Frame-Options (or CSP frame-ancestors), X-Content-Type-Options, Referrer-Policy and Permissions-Policy. Cross-Origin-Opener-Policy is a bonus. A Server header with version numbers, X-Powered-By and X-AspNet-Version lower the score because they tell an attacker which software version to target. An A+ needs both HSTS and CSP to be strong.
Where do I add the headers?
For nginx, add add_header ... always; lines to the server block; without always the header is not sent on error pages. For Apache, mod_headers must be enabled and Header always set is used; on shared hosting these lines can go into .htaccess. If you use Cloudflare, HSTS can also be turned on in the SSL/TLS settings.
Before you ship a CSP
A wrong Content-Security-Policy can stop your scripts, fonts or checkout form. Publish it first as Content-Security-Policy-Report-Only, watch the violations in the browser console for a few days, then switch to the real header. 'unsafe-inline' and 'unsafe-eval' largely cancel CSP's XSS protection; use nonces or hashes for inline scripts.
More free tools
FAQ
About HTTP Security Headers
Only if every subdomain you have works over HTTPS for good. A preloaded domain never opens over http in browsers and getting removed takes months. Start with a short max-age, then raise it to a year and add preload once nothing breaks.
Both prevent clickjacking. frame-ancestors is newer and more flexible and can list several allowed origins; when both are present modern browsers apply frame-ancestors. Adding X-Frame-Options: SAMEORIGIN for older browsers does no harm.
Headers are read with a request from our server in Istanbul. If a protection layer such as Cloudflare sends automated requests to a challenge page, the headers shown are that layer's, not the site's; the tool points this out. Some sites only send headers on certain pages or for logged-in users.