HeaderDial › Guides

Check a site's security headers: paste the response headers

Paste the response headers of a page, as DevTools or curl -I shows them. The checker gives each security header (Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, the Cross-Origin policies, cookies and CORS) a verdict and a plain reason. Then it does what a scanner cannot: it turns the suggested headers into a HeaderDial profile, so you can try the fix in your browser before you deploy it. The text is read in this page: nothing you paste is sent anywhere, and the page makes no network requests after it has loaded (no CDN, no web fonts, no analytics).

Read locally. Nothing you paste leaves this tab.

Verdicts, not a grade. Each row says what the header does and why it is rated that way, from the specifications and MDN listed at the end. There is no letter score: a missing Permissions-Policy and an 'unsafe-inline' script policy are not worth the same, and only you know which pages need what. The count above the table is just a tally.

Copy the response headers

Check the HTML page itself, not an image or a script: headers like CSP and X-Frame-Options only matter on documents, so on other responses they show as not applicable. Check more than the home page, too. Login pages, the API and static files often come from different servers with different headers.

How each header is checked

Content-Security-Policy

A CSP tells the browser where scripts, styles, frames and other resources may come from, so an injected <script> (cross-site scripting) does not run. The checker looks at the source list that governs scripts: script-src, or default-src when there is no script-src.

The suggested value starts from the site's own policy and adds object-src 'none', base-uri 'self' and frame-ancestors where they are missing. Without a policy, it starts from default-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'self', which will probably flag your analytics and inline scripts: that is the point of trying it first. More on changing CSP in the browser: modify Content-Security-Policy and other response headers.

Test a Content Security Policy before deploying it

  1. Edit the suggested policy in the table and leave the mode on Report-Only.
  2. Import the profile into HeaderDial and browse the site with the DevTools Console open. Each resource the policy would block is listed there, but the page keeps working.
  3. Add the sources you trust to the policy (or move inline scripts into files, or give them a nonce on the server), and repeat until the Console only lists things you want blocked.
  4. Switch the mode to enforce to see the page with the policy applied. HeaderDial's set replaces the server's own Content-Security-Policy header with yours on that host. Then put the policy on the server.

A policy in a <meta http-equiv="Content-Security-Policy"> tag is part of the HTML, not a header, so this checker does not see it and a header rule does not replace it. Both apply.

To write a policy from scratch, or edit one directive by directive with a warning for each weak spot, use the CSP builder, which makes the same kind of Report-Only test profile.

X-Frame-Options and frame-ancestors

Both decide which sites may show the page in an <iframe>, which stops clickjacking (a hidden frame of your page under a fake button). When an enforced CSP has frame-ancestors, browsers ignore X-Frame-Options, so the checker rates frame-ancestors first: 'none', 'self' or a list of hosts is good; * or https: lets every site frame the page. Otherwise X-Frame-Options: DENY or SAMEORIGIN is good. ALLOW-FROM is obsolete and current browsers ignore it, so the page can be framed by anyone. If the header carries conflicting values (DENY, SAMEORIGIN), the HTML standard says to block framing entirely. To embed a site you are testing despite these headers, see remove X-Frame-Options and frame-ancestors while testing.

Strict-Transport-Security (HSTS)

HSTS makes the browser use HTTPS for the host for max-age seconds, even when someone types http:// or follows an old link. The checker rates it weak below 6 months (15552000 seconds), at max-age=0 (which deletes the policy), without a valid max-age, and when a directive appears twice: the RFC says such a header is ignored. With preload it also checks the preload list's requirements: at least one year (31536000) and includeSubDomains. A response that arrived over plain HTTP gets not applicable, because browsers ignore HSTS there. If several HSTS headers are sent, browsers use only the first.

The suggested test value is max-age=300 on purpose: the browser stores an HSTS policy and keeps it after you switch the profile off, so a test should expire quickly. Deploy with max-age=31536000; includeSubDomains once every subdomain serves HTTPS. To remove a stored policy, see remove or change HSTS while testing.

X-Content-Type-Options

The only value is nosniff. With it, browsers refuse to run a response as a script or apply it as a stylesheet unless its Content-Type says it is one, and they stop guessing the type of other responses. Anything else is ignored, so it is rated weak. It is the one header here that matters on every response, not just pages. Before deploying, try it: a script served as text/plain will stop loading.

Referrer-Policy

It controls how much of the page's URL is sent in the Referer header when the page loads resources or the user follows a link. URLs can hold search terms, IDs or reset tokens, so the full URL should not go to other sites. unsafe-url (full URL everywhere, even over HTTP) and no-referrer-when-downgrade (full URL to every HTTPS site) are rated weak; strict-origin-when-cross-origin, strict-origin, same-origin, origin and no-referrer are good. The header can list fallbacks separated by commas; browsers use the last value they understand, and so does the checker. Without the header, current browsers use strict-origin-when-cross-origin, so a missing header is a small gap.

Permissions-Policy

It switches browser features off for the page and the iframes in it, for example camera=(), microphone=(), geolocation=(). It is optional hardening: rated missing when absent, weak when it is written in the old Feature-Policy style (camera 'none') or does not parse, because browsers drop an unparseable header entirely. Feature names must be lower case.

Cross-Origin-Opener-Policy, -Embedder-Policy and -Resource-Policy

Set-Cookie

Each cookie gets its own row with only its name and attributes; the value is never shown. A cookie is weak without Secure (it also travels over plain HTTP), without HttpOnly (page scripts, and so an XSS bug, can read it; leave it off only for a cookie your JavaScript must read), and without SameSite (Chrome treats it as Lax, other browsers may send it on cross-site requests). Browsers reject outright a SameSite=None cookie without Secure, a __Secure- cookie without Secure, and a __Host- cookie that lacks Secure or Path=/ or has a Domain. A cookie with Max-Age=0 or an Expires date in the past is being deleted, so it is not applicable. Cookie attributes are set by the server code, so the fix table has no row for them; to test cookies from the browser side, see test with Cookie and Set-Cookie headers.

CORS (Access-Control-Allow-Origin)

Without CORS headers, scripts on other sites cannot read the response, which is the safe default, so the row is not applicable. * lets any site read it without cookies, fine for public data. * together with Access-Control-Allow-Credentials: true is invalid and browsers block such credentialed requests; the dangerous "fix" is to echo back whatever Origin arrives, which hands logged-in data to every site. null is weak because any page can get a null origin from a sandboxed iframe, and two origins in one header are invalid. A specific origin is good; if the server picks it per request, it should also send Vary: Origin. To add CORS headers while developing against an API, see add Access-Control-Allow-Origin for local testing.

Server, X-Powered-By and X-XSS-Protection

A Server value with a version number (nginx/1.18.0, Apache/2.4.41 (Ubuntu)) tells an attacker which known vulnerabilities to try; the product name alone is fine. X-Powered-By, X-AspNet-Version and X-AspNetMvc-Version do nothing for the browser and are rated weak whenever present. The checker shows X-XSS-Protection only when it is sent: 0 is good, anything else is weak, because current browsers no longer have the filter it controlled and in older ones the filter itself could leak information. A CSP is the replacement.

What the checker does not cover

Import the profile into HeaderDial

  1. Tick the fixes, check the host after Only on, and click Copy share link. Open the link: the share page shows the response-header rows. The profile is in the link after the #, which browsers do not send to any server.
  2. Copy the share page's address, open HeaderDial, click Import…, paste it and click Import. Or click Download JSON and choose that file in the same dialog.
  3. Reload the site with DevTools open, and check the new headers under Response Headers. Some headers (CSP, framing, COOP) apply when the page loads, so reload rather than navigate inside a single-page app. Switch the profile off, or press Alt+Shift+D to pause all profiles, when you are done.

The profile only changes what your browser receives. Visitors keep getting the server's headers until you deploy the change.

Sources

The rules above follow these documents; the wording on this page is our own.

Add to ChromeFirefox: coming soon