AgentCan
← All checks

HTTPS and HSTS header checker

Group E2 pointsrubric r1

We check that the final URL after redirects uses https, and that the response has a Strict-Transport-Security header with max-age above zero.

Why it matters

An agent that follows a link to your site over HTTP can be served altered content on the way, and many agents refuse to act on pages like that. HSTS tells the client to use HTTPS only for the stated period. HTTPS is worth 1 point and the HSTS header the second.

How to fix it

  1. Install a valid certificate and redirect all http:// URLs to https:// with a 301.
  2. Add the header Strict-Transport-Security: max-age=31536000; includeSubDomains.
  3. Set the header at the web server or CDN, so every response has it.
  4. Start with a short max-age while you test, then raise it.

How to verify

Run curl -sI https://example.com/ | grep -i strict-transport and expect a max-age value.

HSTS header checker: what the scan reads and what it ignores

This HSTS checker is a scan of your live site, not a validator for pasted text. It requests your homepage with a browser User-Agent, follows redirects, and looks at two things: whether the final URL starts with https:, and whether the response carries a Strict-Transport-Security header whose max-age is greater than zero. It does not inspect the certificate, and it does not grade includeSubDomains or preload. The two responses below look similar but score differently: the first earns 2 of 2 points, the second earns 1, because max-age=0 counts as no HSTS.

$ curl -sI https://example.com/
HTTP/2 200
content-type: text/html; charset=utf-8
strict-transport-security: max-age=31536000; includeSubDomains

$ curl -sI https://weak.example.com/
HTTP/2 200
content-type: text/html; charset=utf-8
strict-transport-security: max-age=0

How the HSTS header is scored

  1. The header is read from the response to the homepage request, which is sent with a browser User-Agent. Headers that appear only for other paths or other clients are not seen.
  2. The scan extracts max-age=<number> from the header value with a pattern match. The number must be greater than 0, so max-age=0 earns nothing.
  3. The HTTPS point depends only on the final URL after redirects. If http://example.com redirects to https://example.com, the final URL is https and the point is awarded.
  4. The HSTS point is given only when HTTPS already passed. A site that ends on plain HTTP scores 0 of 2, even if it sends the header.
  5. The certificate is not checked: expiry, hostname match and chain are outside this scan, so verify them separately in a browser or with your certificate tooling.
  6. includeSubDomains and preload do not change the score. They matter for real-world security, but this check only needs a positive max-age.

Common HSTS header mistakes

HSTS FAQ

What is HSTS?
HTTP Strict Transport Security is a response header. After a browser or client sees it once over HTTPS, it connects to that host over HTTPS only for the number of seconds in max-age, and does not try plain HTTP first.

Which max-age should I set, and why 31536000?
31536000 seconds is one year, a common value for a stable site. Start with something short such as 300 while you confirm every page and subdomain works over HTTPS, then raise it. Any value above 0 passes this scan.

What does preload do, and why is it not scored?
The preload token signals that you want the domain added to the browser preload lists, so HTTPS is enforced even on the first visit. Joining those lists is a separate commitment that is hard to undo. This scan only reads the header on one response, so it does not score preload.

How can I check HSTS without the scanner?
Run curl -sI https://example.com/ | grep -i strict-transport. If nothing prints, the header is missing on that response. Add -A "Mozilla/5.0" to mimic a browser User-Agent, and -L to follow redirects.

Does HSTS affect rankings or AI agents?
Not directly. We make no claim that it changes Google rankings. In our rubric it is one point out of the trust group: a signal that the site is served securely, nothing more.

Check your site free

Related checks

All checks

AgentCan scores a site at one moment; it is not a guarantee about how every agent will treat it.