HSTS header guide

Strict-Transport-Security Header: HSTS in Plain English

The Strict-Transport-Security header, commonly called the HSTS header, tells supporting browsers to use HTTPS for your host for a set period after they receive it. Once a browser has seen the header, it upgrades later requests to that host itself rather than trying plain HTTP first.

It is a straightforward header with one important precondition: HTTPS has to already work properly across your site before you send it.

What HSTS is for

Without HSTS, a visitor who types your domain without https:// makes an initial plain HTTP request that is then redirected. That first unencrypted request is the window an attacker on the same network can interfere with.

HSTS closes that window for browsers that have already received the header, because they go straight to HTTPS. It does nothing for the very first visit from a browser that has never seen your header before, which is the gap the preload list is meant to address.

What max-age, includeSubDomains and preload mean

The header carries a small number of directives. At a high level:

  • max-age — how long, in seconds, the browser should remember to use HTTPS for this host. Short values are sensible while you are testing; longer values are used once HTTPS is proven stable.
  • includeSubDomains — applies the same rule to every subdomain. Only use it once you are confident every subdomain, including internal or legacy ones, serves HTTPS correctly.
  • preload — signals an intention to be included in browser preload lists so HTTPS is enforced even on a first visit. Removal from those lists is slow, so treat it as a deliberate, long-term commitment rather than a quick win.

Why HTTPS must work first

HSTS removes the browser's willingness to fall back to HTTP. If a certificate expires, a subdomain is not covered, or an old system still serves plain HTTP, visitors may see hard errors with no easy way past them.

Before enabling it, confirm valid certificates on every hostname you serve, working HTTP-to-HTTPS redirects, and a certificate renewal process someone is actually responsible for. Then start with a short max-age and extend it.

How to check the HSTS header

In Chrome, press F12, open the Network tab, reload the page over HTTPS and inspect the document request's Response Headers for Strict-Transport-Security. If the header is absent, browsers have no standing instruction to force HTTPS for your host.

The free website security check on this site also reports whether the header is returned, along with the rest of your externally visible HTTPS configuration.

Check your website security headers

ScoutLab's free website security check looks at whether these headers are present and how they are configured on your public site, alongside HTTPS, DNS and email protection signals. It reports what it observes so you can discuss the results with whoever maintains your website.

Run the free website security check

Frequently asked questions

What is the Strict-Transport-Security header?

It is an HTTP response header that tells supporting browsers to use HTTPS for your host for the period given by its max-age directive. After receiving it, the browser upgrades requests to that host itself instead of attempting plain HTTP first.

How do I check the Strict-Transport-Security header in Chrome?

Load your site over HTTPS, press F12, open the Network tab, reload, then click the document request and read the Response Headers. Look for a Strict-Transport-Security entry and note its max-age value and whether includeSubDomains or preload are present.

Should I enable includeSubDomains and preload?

Only after deliberate validation. includeSubDomains applies the HTTPS requirement to every subdomain, including ones you may have forgotten about, and preload is difficult to reverse quickly. Confirm that every hostname serves valid HTTPS before committing to either.

Does HSTS protect the very first visit to my site?

Not by itself. A browser has to receive the header once before it can act on it, so the first request from a brand new browser is not covered. Preload lists exist to close that gap, at the cost of a commitment that is slow to undo.

Technical references

Security headers are browser-facing HTTP response controls and one layer of defence. They work alongside patching, access control, backups and monitoring rather than replacing them.