HTTP Strict Transport Security (HSTS)

What the Strict-Transport-Security header does, which max-age to use, and how to turn it on without locking yourself out.

What AuditX checks

The scan reads the Strict-Transport-Security header on your HTTPS response. It passes with a max-age of at least six months (15768000 seconds) and includeSubDomains, and the report notes whether preload is set. On a subdomain host such as www.example.com, six months or more also passes without includeSubDomains, because there that flag would only cover hosts under www; the report then says to send includeSubDomains from example.com itself. A shorter max-age warns, and so does a bare domain without includeSubDomains. A max-age of 0, or a header without max-age, tells browsers to forget HSTS for the site, so it warns as giving no protection. The warning gives the lifetime in days, months or years and says which part is missing. A domain whose ending is itself on the HSTS preload list built into browsers, such as .dev, .app, .page or .bank, passes whatever the header says, because browsers only ever connect to it over https.

Why it matters

Without HSTS, a visitor who types your domain without https:// makes a first request over plain HTTP. Anyone on the same network, such as a cafe Wi-Fi, can intercept that request before your redirect to HTTPS happens.

With HSTS, the browser remembers that your site is HTTPS-only and never makes that plain request again for as long as max-age lasts.

How to fix it

  1. Make sure every page and every subdomain you use already works over HTTPS. HSTS makes HTTP unreachable, so a subdomain that only works over HTTP will break.
  2. Start with a short lifetime, for example max-age=300 (five minutes), and check that nothing breaks.
  3. Raise it to one year: max-age=31536000. Add includeSubDomains once every subdomain is on HTTPS.
  4. Only add preload and submit the domain at hstspreload.org when you are sure: removing a domain from the preload list takes months.
Strict-Transport-Security: max-age=31536000; includeSubDomains

Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.

Scan my site

Sources

Related checks

Last reviewed 2026-11-13.