SEO

HSTS

Also called HTTP Strict Transport Security

A response header telling browsers to reach a hostname only over HTTPS for a stated period, skipping any plain request.

Quick facts: HSTS

Category
SEO
Also called
HTTP Strict Transport Security
Level
Advanced
Affects
Connection security, first-visit speed, site availability
Where to see it
Browser network tab response headers, curl, hosting or CDN header settings
In this article4
  1. How HSTS works
  2. Why HSTS matters
  3. Where HSTS goes wrong
  4. Getting it right

How HSTS works

Even on a fully secure site, the first request a browser makes can still be a plain one. Someone types the domain without a protocol, the browser tries the open version, and your server redirects it. That first exchange happens in the clear, and it is the moment an attacker on the same network can intercept and hold the visitor on a plain connection.

HSTS closes that gap. It is a response header — Strict-Transport-Security — that your server sends over an encrypted connection, and it tells the browser to use HTTPS for this hostname from now on. The browser remembers, and on every later visit it rewrites the address internally before making any request. Nothing goes out in plain text and the redirect hop disappears.

The header carries a maximum age in seconds, saying how long the instruction lasts, and it is refreshed on each visit. It can add an instruction to apply to every subdomain, and a request to be added to the preload list that browsers ship built in, which protects even a visitor who has never been to your site before.

Why HSTS matters

It removes a category of attack that a certificate alone does not. Without it, a visitor on a shared or hostile network can be quietly kept on the plain version of your site and shown something that is not yours. With it, the browser will not make that connection at all, and shows an error the visitor cannot click past instead.

There is a smaller, everyday benefit too. Skipping the plain request removes a round trip on the first visit, which is worth something on a slow mobile connection. HSTS is not itself a ranking factor, and no search engine rewards it directly.

Where HSTS goes wrong

Almost every problem is the same problem: it was switched on too confidently. The instruction is stored in the visitor’s browser, not on your server, so you cannot withdraw it from someone who has already received it. If your certificate lapses, or a subdomain has none, those visitors cannot reach the site and turning HTTPS back off does not help them — their browser refuses to try.

The subdomain instruction causes most of the accidents. It applies to every host beneath the domain, including a staging server, an old mail interface or a legacy system nobody remembered, any of which may have no certificate at all. Preloading is the other trap: getting onto the browsers’ built-in list is straightforward, coming off it takes a long time and rides along with browser release schedules.

A quieter mistake is sending the header over plain HTTP, where browsers ignore it entirely. If it is not being served on the encrypted response, it is doing nothing.

Getting it right

Do it last, not first. Make sure every hostname you own has a valid certificate with renewal automated and independently monitored, that plain requests already redirect properly, and that no mixed content remains anywhere on the site.

Then start with a short maximum age and watch for problems for a while before extending it. Add the subdomain instruction only after you have listed every subdomain and confirmed each one is served securely. Treat preloading as a separate decision, taken only when you are certain the hostname will never need to answer over plain HTTP again. Handled in that order it is a sensible last step of a move to HTTPS; handled first it is the reason a site goes dark for the people who visit it most.

Do and do not

Do

  • Fix certificates, redirects and mixed content before enabling it
  • Start with a short maximum age and extend gradually
  • Audit every subdomain before adding the subdomain instruction

Do not

  • Enable preload until you are certain it is permanent
  • Send the header on plain HTTP responses
  • Assume you can withdraw it from browsers that stored it

Questions people ask about this

Does HSTS help my SEO?

Not directly. No search engine treats the header as a ranking signal. The indirect gains are real but modest: browsers skip the plain request, so first visits start marginally sooner, and there is no window in which a visitor can be diverted to an insecure copy of your site. Fix your redirects and certificates first, since those matter far more.

Can I turn HSTS off if something breaks?

Not for anyone who already received the header. The instruction lives in each visitor's browser until its stated period expires, so removing it from your server only affects new visitors. You can shorten the maximum age to limit future damage, but existing visitors stay locked to HTTPS. That is exactly why you start with a short period and lengthen it slowly.

Should I include subdomains?

Only after auditing every subdomain you own. The instruction applies to all of them, including staging environments, old webmail hosts and systems inherited from a previous developer. Any one of them without a valid certificate becomes unreachable for visitors whose browsers have stored the instruction, and you cannot reverse that for them from your side.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.