Security headers: what the check tests and how to fix it

Looks for four response headers on the homepage only: CSP, X-Frame-Options, X-Content-Type-Options and HSTS. Three of four passes. Values are not judged.

Technical · Weight 1 in the w2agent Score

How common is it?

45% of 1223 measured sites where this check applied pass.

Latest audit of each site under rubric v3.1. Sites where the check did not apply or could not be measured (for example, no llms.txt for the llms.txt checks) are left out. A partial result does not count as a pass.

What this check tests

Unlike most checks, this one reads a single page: the first crawled page, which is the homepage. It takes that response's headers (names are lower-cased) and records whether each of four is present with a non-empty value:

  • content-security-policy
  • x-frame-options
  • x-content-type-options
  • strict-transport-security

The score is the number present out of four: 0, 25, 50, 75 or 100.

  • Pass: three or four headers present.
  • Partial: one or two.
  • Fail: none.
  • Skip: only if no page was crawled, which a normal audit does not produce.

The result lists each header with a tick or a cross. The check does not read the values, so X-Frame-Options: ALLOWALL, a CSP of default-src * and an HSTS max-age=0 all count as present. Only response headers count; a policy set with a <meta http-equiv> tag is not seen. The headers come from the final response after redirects, and other pages are not examined, so an inner page that lacks a header is not reported. Other useful headers such as Referrer-Policy and Permissions-Policy are not tested.

Why it matters to agents

Be clear about the reach. These four headers are instructions that browsers enforce for the people using a site. MDN describes CSP as mainly a defence against cross-site scripting, X-Frame-Options as a way to avoid clickjacking by stopping other sites embedding your pages, X-Content-Type-Options: nosniff as a way to make browsers use the declared Content-Type, and HSTS as telling browsers to reach the host only over HTTPS. MDN also notes that site security testers usually expect X-Content-Type-Options to be set.

This page cites no source saying that an AI assistant or crawler reads, or rewards, these headers when it fetches your page. The link to agents is indirect: they protect the people who follow an agent's answer to your site, and a security scanner or a procurement review may look for them. The weight is 1, and a site can have a high AI-readiness score without them. Treat it as site hygiene.

How to fix it

Set the headers at the server, CDN or framework layer so they apply to every response, not only the homepage.

Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'self'; frame-ancestors 'self'
  • Strict-Transport-Security: only send it over HTTPS and once HTTPS works everywhere. max-age is how many seconds browsers remember the rule. MDN says preload needs at least a year and includeSubDomains, so leave preload out until you are sure. See HTTPS.
  • X-Content-Type-Options: nosniff is the only value.
  • X-Frame-Options: DENY or SAMEORIGIN. MDN points to the CSP frame-ancestors directive for more comprehensive control. This check still looks for the older header, so send both if you want a full score.
  • Content-Security-Policy: the example above is a starting point that will break pages loading scripts, styles or images from other hosts. Write the policy for your site, test it, and roll it out gradually. MDN says CSP can be deployed in report-only mode first, where violations are reported but not enforced. That mode uses a different header name, Content-Security-Policy-Report-Only, which this check does not count, so the cross stays until you switch to the enforcing header.

Check with curl -sI https://example.com/ and read the response headers. If your CDN or host has a headers setting, use that rather than editing every template.

Examples from measured sites

Up to 10 of the highest-scoring sites in each group, from recent audits. Failing includes partial results.

Passing

Failing or partial

Sources

Verified against these sources on

Does your site pass this check?

Check your own site →