Performance + SEO + UX Intelligence

Security Headers Checker: Test CSP, HSTS and the Headers Browsers Enforce

|
Published:
|
Updated:

Security headers tell the browser how to protect your visitors: which scripts may run, whether the site may be framed, and that it must always use HTTPS. Enter a URL to see which headers are missing or too weak, with the exact value to set. Free with a Google sign-in.

Free · No signup required · Results in about a minute

Core headers

5

CSP, HSTS, X-Frame-Options, nosniff and Referrer-Policy

HSTS preload

1 year

Minimum max-age of 31536000 seconds

Setup time

Minutes

Most headers are one line of server config

Introduction

HTTP security headers are instructions your server sends with every page. The browser enforces them, so they protect visitors even when something else goes wrong, such as a script injected through a comment form or a link that tries to load your site inside someone else's frame.

They cost nothing to add and most are a single line in your web server, CDN or framework config. Yet many sites ship without them because nothing visibly breaks when they are missing.

This security headers checker reads the response headers of your page and grades each one. It goes beyond "present or missing": it flags a Content-Security-Policy that still allows unsafe-inline scripts, an HSTS header too short for the preload list, and headers that reveal your server software and version.

Why Security Headers Matter

A strict Content-Security-Policy is the strongest defence against cross-site scripting (XSS): even if an attacker manages to inject a script tag, the browser refuses to run code from a source you did not allow.

Strict-Transport-Security (HSTS) stops downgrade attacks. Once a browser has seen it, it will only ever connect over HTTPS, so nobody on the same Wi-Fi network can intercept the first plain-HTTP request.

Headers that announce "Apache/2.4.58" or "X-Powered-By: PHP/8.1" do not break anything on their own, but they let automated scanners match your exact version against lists of known vulnerabilities. Hiding them removes an easy shortcut.

What the Security Headers Checker Looks At

Content-Security-Policy

Whether a policy exists, whether it is only report-only, and whether it allows unsafe-inline, unsafe-eval or wildcard sources.

Strict-Transport-Security

The max-age value, includeSubDomains and the preload directive needed for the browser preload list.

Framing, sniffing and referrers

X-Frame-Options (clickjacking), X-Content-Type-Options: nosniff and Referrer-Policy.

Leaks and cookies

Server and X-Powered-By version numbers, wildcard CORS with credentials, and cookies missing Secure, HttpOnly or SameSite.

Each finding comes with the recommended value, so you can copy it into your config instead of reading the specification.

How It Works

Site Vitals loads your page in a real browser and records the response headers of the main document, plus any cookies set while the page loads.

It parses the Content-Security-Policy directive by directive, checks the HSTS max-age against the one-year minimum used by the preload list, and compares the other headers against current recommendations from OWASP and browser vendors.

The header summary appears in the Security section of your report and the deeper checks (CSP strength, HSTS strength, version disclosure, CORS and cookies) in the Server Security section. Both need a free Google sign-in to view in full.

How to Add Missing Security Headers

  1. 1. Scan your site

    Run the checker on your home page and on one logged-in or checkout page if you have them; headers can differ per route.

  2. 2. Start with the safe ones

    Add X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin and X-Frame-Options: SAMEORIGIN. They rarely break anything.

  3. 3. Turn on HSTS gradually

    Start with max-age=300, confirm every subdomain works over HTTPS, then raise it to 31536000 and add includeSubDomains.

  4. 4. Roll out CSP in report-only mode

    Send Content-Security-Policy-Report-Only first, collect violations for a week, then switch to the enforcing header.

  5. 5. Hide version numbers

    Set ServerTokens Prod in Apache, server_tokens off in Nginx and expose_php = Off in PHP.

  6. 6. Scan again

    Confirm each header shows as passing and that the site still works in a normal browser session.

Common Security Header Mistakes

Shipping a Content-Security-Policy that includes 'unsafe-inline' for scripts, which removes most of its XSS protection.

Leaving CSP in report-only mode for months, so nothing is actually blocked.

Adding HSTS with preload before checking that every subdomain supports HTTPS.

Setting headers in the application only, so error pages and static files served by the web server go out without them.

Sending "Access-Control-Allow-Origin: *" together with credentials.

Recommended Header Values

These values are a safe starting point for most sites. Content-Security-Policy is the one that needs tailoring to the scripts and styles you load.

HeaderRecommended valueProtects against
Strict-Transport-Securitymax-age=31536000; includeSubDomainsDowngrade to HTTP
Content-Security-PolicyNonce or hash based, object-src 'none'Cross-site scripting
X-Frame-OptionsSAMEORIGIN or DENYClickjacking
X-Content-Type-OptionsnosniffMIME type confusion
Referrer-Policystrict-origin-when-cross-originLeaking full URLs

Security Header Best Practices

Set headers at the outermost layer that serves every response, usually the CDN or web server, so static files and error pages are covered too.

Use nonces or hashes for inline scripts instead of 'unsafe-inline'; most frameworks can add a nonce automatically.

Prefer the CSP frame-ancestors directive for framing rules, and keep X-Frame-Options for older browsers.

Re-scan after deploying new third-party scripts; a CSP that was correct last month may now block or allow the wrong sources.

Treat headers as one layer of defence. They do not replace keeping your CMS, plugins and libraries up to date.

Frequently Asked Questions

Which security headers should every site have?

At minimum: Strict-Transport-Security, X-Content-Type-Options: nosniff, a framing rule (X-Frame-Options or CSP frame-ancestors) and Referrer-Policy. Add a Content-Security-Policy as soon as you can test it.

Do security headers affect SEO?

Not directly. Google does not rank pages by their headers. They protect your visitors and your reputation; a hacked site that serves spam or malware is what hurts rankings.

Is X-XSS-Protection still needed?

No. Modern browsers have removed the filter it controlled, and in old browsers it could introduce problems. Set it to 0 or leave it out, and rely on Content-Security-Policy.

Why do I need to sign in to see the results?

Speed and SEO results are open to everyone without an account. The other report sections, including security headers, need a free Google sign-in. Once you are signed in, every report you run shows in full.

Will adding CSP break my site?

It can if the policy misses a source you use. That is why the safe path is to start with Content-Security-Policy-Report-Only, fix what it reports, then enforce it.

Summary

A handful of response headers block whole classes of attacks for every visitor, and most take a single line to add. Checking them takes a minute.

Run the security headers checker after server moves, CDN changes and new third-party integrations, since those are the moments headers quietly disappear.

Check Your Security Headers

Find missing or weak CSP, HSTS and framing headers, plus version leaks and insecure cookies, with the exact value to set.