Why it matters
- A visitor who types the site's name without
https://, or follows an old link that starts withhttp:, sends the first request over HTTP before the site redirects it. At that moment, anyone on the way can keep them on HTTP and read what they send. - The
Strict-Transport-Securityheader (HSTS) tells the browser to use only HTTPS for this site formax-ageseconds, so no later request goes over HTTP. - Some browsers now try HTTPS first by themselves (Chrome does), and a site on the HSTS preload list is covered from the first visit in browsers that ship the list. The header is what tells every browser, and the list asks for it too.
How to fix
Send the header in HTTPS responses, for a year, for example:
http
Strict-Transport-Security: max-age=31536000; includeSubDomainsincludeSubDomainscovers subdomains, so add it once you are sure they all work on HTTPS, or start with a short duration and raise it.- The HSTS preload list adds your site to the browsers themselves, so even the first visit goes over HTTPS. Its requirements are on its site.
How we detect
- We read the first
Strict-Transport-Securityheader of the page's response, since the browser reads only the first. - The rule fails when there is none, when its
max-ageis zero, or when it breaks the header's grammar (RFC 6797), which makes browsers ignore it: withoutmax-age, withmax-ageorincludeSubDomainstwice, with a value onincludeSubDomains, or with a quote left open. - Pages on HTTP and IP addresses are left out, since browsers keep no HSTS for them.