Skip to content

What is HSTS?

The header that forces a browser to talk to a site only over HTTPS, closing the window a plain redirect leaves open.

HSTS (HTTP Strict Transport Security) is an HTTP response header through which a site tells the browser to remember, for a stated number of seconds, that it must only be reached over HTTPS. From that point on, the browser converts every HTTP request to that domain into HTTPS on its own, before it ever leaves the machine, and if the server's certificate turns out expired, invalid, or issued for another name, it blocks the connection without offering the button that normally lets a visitor proceed anyway. The standard is described in RFC 6797. The mechanism closes a gap that HTTPS alone does not cover: a site reachable over both HTTP and HTTPS leaves open the chance that an attacker on the same network intercepts that first unencrypted request and redirects it elsewhere before the redirect to HTTPS ever fires. HSTS removes that gap by enforcing HTTPS on the browser side, not the server side.

See also: SSL/TLS certificateThe digital file that encrypts a site's traffic and authenticates its domain, but does not certify the site is trustworthy.

The directives and the first-visit gap

The RFC defines two directives. max-age is the number of seconds the browser remembers the rule for, a count that restarts with every response repeating it. includeSubDomains extends the HTTPS requirement to every subdomain, not only the one that sent the header. The third, preload, is not in the standard: it is how a site consents to joining the list browsers ship with built in. A gap remains: on the very first visit ever, before the browser has received that header even once, the first request can still go out in the clear if someone types the address without https://, which is exactly the window a man-in-the-middle attack exploits. The preload list at hstspreload.org, run by the Chromium project and the basis of the other major browsers' lists, closes that gap: the domain ships hardcoded inside the browser binary itself, so the very first request already goes out over HTTPS, never touching a response header at all. To be accepted, a site must serve a valid TLS certificate, redirect HTTP to HTTPS on the same host, serve every subdomain over HTTPS, declare a max-age of at least one year, and include both includeSubDomains and preload in the same header.

A concrete example

A professional practice with a marketing site and a client-portal subdomain decides to turn HSTS on. The correct sequence starts cautious: a max-age of a few hours, with no includeSubDomains, to verify over the following days that every asset, images included, really loads over HTTPS and that no forgotten subdomain (an old staging environment, a third-party service wired up years before) still answers only over HTTP. Only after that check, which belongs to the site's routine maintenance, does the value move up to a year, does includeSubDomains get added, and only then is the preload request submitted. Skipping the cautious phase and turning everything on at once exposes the risk in the next paragraph directly.

Why it matters for decision makers

The risk of includeSubDomains is real: any subdomain still served only over HTTP, even a forgotten one, becomes unreachable for anyone who has already received the header, because the browser refuses the plain connection and there is no HTTPS to offer in its place. And the most delicate line of all is preload: once a domain is on the list, it is baked into every copy of the browsers that use it, and getting off requires a removal request followed by the release cycles of each browser, months during which anyone visiting that domain from a browser not yet updated cannot reach it over HTTP even by mistake. That is why the cautious rollout is not an operational detail: it keeps every stage reversible until the last one.

  • SSL/TLS certificateThe digital file that encrypts a site's traffic and authenticates its domain, but does not certify the site is trustworthy.
  • Man-in-the-middle attack (MitM)An attacker positions themselves between two communicating parties, reading or altering traffic without either side noticing.
  • Website maintenanceThe recurring work that keeps a site secure and working: patches, verified backups, TLS, uptime, content.
  • Network segmentationNetwork segmentation divides systems and services into zones with controlled connections, limiting the spread of attacks and protecting business operations.

See it in the universe

If it is a technical decision you keep postponing, that is the decision I help you make.

See custom tools, governance and operations

Or write to me.