HSTS: HTTP Strict Transport Security pour le SEO

Ce que HSTS en réalité fait, the Strict-Transport-Security header syntax (max-age, includeSubDomains, preload), le navigateur-only internal redirection robots d’exploration jamais voir, pourquoi it doesn't replace votre 301s, and how preload peut lock vous in — from Patrick Stox.

Première publication : 3 juil. 2026 · Dernière mise à jour : 3 août 2026 · Advanced
Langues
1 indice probant sur cette page

HSTS (HTTP Strict Transport Security) is a Strict-Transport-Security réponse header — honored seulement quand it arrives over a secure connection — que indique a navigateur to toujours utiliser HTTPS pour votre domain going forward, closing the insecure gap que a nouveau visitor's premier requête encore rend over HTTP avant votre 301 fires. It's a browser-layer, per-client policy on top of votre serveur-side redirections, pas a replacement: RFC 6797 has le navigateur rewrite the URI to HTTPS internally avant quelconque requête goes out (souvent affiché as an internal 307-style redirection, though the RFC doesn't mandate a spécifique code d’état), so aucun server ever sees the HTTP formulaire and robots d’exploration encore besoin votre réel 301 to comprendre the déplacer and carry popularité des liens. The header has three directives — max-age (requis), includeSubDomains, and preload. Preload bakes votre domain into le navigateur itself via hstspreload.org (requiring max-age of au moins a année, includeSubDomains, and the preload flag) and is fermer to irreversible — removal is a separate submission que takes months to reach utilisateurs. HSTS is aussi deliberately unforgiving: a navigateur que knows vous as an HSTS host va hard-fail with aucun click-through si votre certificate ever breaks. So enable it seulement une fois HTTPS is genuinely solid à travers every subdomain, and treat preload as a one-way door.

TL;DR — HSTS is the Strict-Transport-Security réponse header, honored seulement quand a navigateur receives it over a secure connection, and stored per-client as future policy pour que host. It closes the “first request problem” a 301 alone leaves ouvrir: the initial HTTP requête from a nouveau visitor is insecure jusqu’à the redirection fires, and that’s the window an SSL-stripping attacker veut. Three directives: max-age (requis, seconds), includeSubDomains, preload. Quand a navigateur enforces HSTS it rewrites the URI to HTTPS internally, avant quelconque requête reaches a server — RFC 6797 doesn’t mandate a spécifique code d’état pour que rewrite, though outils souvent surface it as a 307 — so votre server-side 301s are encore mandatory pour moteur de recherches and popularité des liens; HSTS is on top of les, pas à la place. Preload bakes votre domain into le navigateur via hstspreload.org (exige max-age ≥ 31536000, includeSubDomains, and preload) and is fermer to irreversible — removal is a separate submission que takes months to reach utilisateurs. And HSTS is designed to hard-fail on quelconque cert error, so enable it seulement quand HTTPS is robust à travers every subdomain.

The HTTPS hub introduces HSTS as a browser-layer protection que sits on top of votre 301s. Ce page is the deep dive: the exact header syntax, the internal redirection que trips SEOs up, the preload list’s near-irreversibility, and the real-world façons HSTS locks personnes out.

The problem HSTS en réalité solves: the premier requête

Picture a correctement migrated site. Every http:// URL 301-redirections to its https:// twin, the certificate is valid, canonicals point to HTTPS. Semble airtight. It isn’t, quite.

Quand a brand-new visitor types yoursite.com (aucun scheme) or clicks an old http://yoursite.com lien, le navigateur’s premier requête goes out over plain HTTP. Votre serveur réponses with the 301, and every requête après que is secure. But que un initial round-trip happened in the clair — and that’s exactly the window an SSL-stripping attacker on the même network veut. Ils intercept the HTTP requête, garder the victim on HTTP pendant que ils proxy HTTPS to votre serveur, and lire or rewrite everything.

HSTS eliminates que window pour anyone who has visited avant. web.dev is direct à propos de the mechanism: “utiliser Strict Transport Security to tell clients ils devrait toujours connecter to votre server en utilisant HTTPS, même quand suivant an http:// référence. Ce defeats attacks comme SSL Stripping, and avoids the round-trip cost of the 301 redirection.” (web.dev). Que dernier clause matters pour performances aussi: a returning navigateur skips the HTTP→HTTPS round-trip entirely. Evidence for this claim After receiving HSTS, a browser upgrades future HTTP attempts to HTTPS before sending the request. Scope: MDN documents user-agent enforcement after the header has been learned; first-visit protection requires preload or a prior secure visit. Confidence: high · Verified: MDN: Strict-Transport-Security header

Two boundary conditions worth being precise à propos de. Premier, HSTS is stored, per-client policy — it lives in que un browser’s propre state pour que host, learned from a header delivered over a secure connection; the même header sent on an HTTP réponse is ignored outright (an attacker who peut inject or strip headers on plain HTTP pourrait sinon neutralize it), and a client que has jamais reçu it — a fresh install, a différent navigateur, a robot d’exploration — has aucun policy to enforce. Second, the rewrite is scheme-and-port aware: an implicit port 80 requête becomes an implicit port 443 requête, but si the original URI named an explicit non-default port, le navigateur garde que même port number and simply contacts it over HTTPS à la place.

The header syntax

HSTS is un réponse header with up to three directives. Per MDN, the formulaires are:

Strict-Transport-Security: max-age=31536000
Strict-Transport-Security: max-age=31536000; includeSubDomains
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
  • max-age=<seconds> — requis. “The temps, in seconds, que le navigateur devrait remember que a host is seulement to be accessed en utilisant HTTPS” (MDN). 31536000 is un année; 63072000 is two. The clock resets on every réponse que carries the header, so an active site continually renews its policy. Ce is relative, per-client state: simply removing the header doesn’t immédiatement clair it — a navigateur que déjà learned the policy garde enforcing it jusqu’à its stored max-age runs out. To turn HSTS off pour clients que déjà learned it, vous have to actively serve max-age=0 over a secure réponse; le navigateur alors forgets the policy on its suivant secure visit. (max-age=0 clears a learned policy seulement — it ne fait pas supprimer a domain from the separate preload liste.)
  • includeSubDomains — optional. “Si ce directive is specified, the HSTS policy s’applique to tout subdomains of the host’s domain as bien” (MDN). Powerful and dangerous in equal mesurer — voir the lockout scenarios ci-dessous.
  • preload — optional. A flag que signals votre intent to be on le navigateur preload liste. It ne fait pashing on its propre; it’s a prerequisite pour submitting to hstspreload.org. Evidence for this claim HSTS preload requires at least a one-year max-age, includeSubDomains, and preload; removal can take months to reach users. Scope: The Chromium preload service documents submission and removal behavior; requirements can change and should be rechecked before submission. Confidence: high · Verified: Chromium: HSTS Preload List Submission

The behavior, à nouveau from MDN: “Avant chargement an http URL, le navigateur checks the domain nom contre its HSTS hosts liste. Si the domain nom is a cas insensitive match pour an HSTS host or is a subdomain of un que specified includeSubDomains, alors le navigateur replaces the URL scheme with https.”

The internal upgrade robots d’exploration jamais voir (ce is the SEO crux)

Here’s the unique la plupart misunderstood chose à propos de HSTS, and the raison it can’t replace votre redirections.

Quand a navigateur upgrades an http:// requête sous HSTS, it rewrites the URI to HTTPS internally, avant quelconque network requête is made — RFC 6797 exige the scheme substitution itself but ne fait pas mandate a particulier code d’état pour it (RFC 6797 §8,3), so a donné navigateur or exploration outil may represent que internal step cependant it likes — nombreux afficher it as an internal 307, but that’s client/tool-specific, pas a protocol guarantee. Ce que matters pour le SEO is simpler and holds regardless of the étiquette: aucun server is contacted pour the HTTP version, so aucun robot d’exploration ever sees it. Googlebot and Bingbot don’t carry a learned HSTS policy autour the façon a returning human’s Chrome fait — ils hit votre serveur fresh, and ce que ils besoin to voir là is a réel, server-side 301. Evidence for this claim RFC 6797 requires the user agent to rewrite a known-HSTS-host HTTP URI to HTTPS internally, but does not mandate any specific redirect status code for that internal rewrite; how a given browser or crawling tool represents that step (e.g., as an internal 307) is a client/tool implementation detail, not a protocol requirement. Scope: RFC 6797 Section 8.3 ("URI Loading and Port Mapping") specifies the UA MUST replace the URI scheme with https; it does not prescribe an HTTP status code for that internal substitution, since no HTTP exchange occurs for it. Section 7.2's suggestion of status code 301 addresses ordinary server-side redirect behavior, not this internal client-side rewrite. Confidence: high · Verified: RFC 6797 §8.3 — URI Loading and Port Mapping

So the rule is blunt: HSTS ne fait pas replace votre serveur-side 301s. The 301 is ce que moteur de recherches utiliser to comprendre the protocol déplacer and to consolidate signals (301 and autre redirection permanentes don’t causer a loss in PageRank, per Google). Le navigateur-only internal upgrade is a user-experience and security couche on top. Vous besoin les deux, doing différent jobs:

  • 301 (server-side): pour robots d’exploration, indexation, and popularité des liens.
  • Internal 307-style upgrade (browser-side, from HSTS): pour returning humans and SSL-stripping protection — the exact status representation varies by client/outil.

Quelconque guide que indique vous HSTS “handles the redirect so you can drop your 301” is incorrect in a façon que va quietly cost vous.

HSTS preload: the near-permanent version

max-age protects returning visitors, but it has a bootstrap problem: a first-time visitor who has jamais reçu votre header is encore exposed on que initial requête. Preload solves it by hardcoding votre domain into le navigateur’s source itself, so le navigateur knows you’re HTTPS-only avant it has ever connected.

Vous opt in at hstspreload.org. The requirements are exact:

  1. “Serve a valid certificate.”
  2. “Redirect from HTTP to HTTPS on the same host, if you are listening on port 80.”
  3. “Serve all subdomains over HTTPS” — notamment in particulier the www subdomain si a DNS record exists.
  4. On the base domain’s HTTPS réponse, an HSTS header où “the max-age doit be au moins 31536000 seconds (1 année),” “the includeSubDomains directive doit be specified,” and “the preload directive doit be specified.” (hstspreload.org)

That’s pourquoi the two-year exemple ci-dessus (max-age=63072000; includeSubDomains; preload) is the shape personnes submit — remarque ces are the exact submission requirements as publié by hstspreload.org; treat les as the current bar, pas a permanent constant, and re-check the live page avant vous submit.

It helps to garder four distinct states straight, since personnes conflate les constantly:

StateWhat’s en réalité vrai
Token présentVotre header inclut preload. Ce is a flag seulement — it ne fait pashing by itself and doesn’t put vous on quelconque liste.
EligibleVotre site meets tout four hstspreload.org requirements ci-dessus (cert, redirection, subdomains, header shape). Encore pas on the liste.
Submitted / pendingYou’ve submitted at hstspreload.org and it’s queued pour inclusion in an upcoming navigateur release. Pas yet enforced pour réel utilisateurs.
En réalité listedThe domain is baked into a donné browser’s shipped construire. Enforcement seulement exists pour utilisateurs on que construire — rollout isn’t instant or universal à travers navigateurs.

Removal runs the même four states in reverse, and simplement as slowly: removing the preload directive from votre header rend vous eligible pour the removal formulaire, alors submission is pending, and the domain stays enforced pour quelconque utilisateur on a navigateur construire que encore ships it — jusqu’à que construire cycles out.

Now the partie que turns preload into a one-way door. From the submission site itself: “Be aware que inclusion in the preload liste ne peut pas easily be undone. Domains peut be supprimé, but it takes months pour a modifier to reach utilisateurs with a Chrome mettre à jour and we ne peut pas faire guarantees à propos de autre navigateurs.” (hstspreload.org). And its propre advice: “Don’t requête inclusion unless you’re certain que vous pouvez prise en charge HTTPS pour votre entier site and tout its subdomains in the long term.”

Practical translation: preload is a genuinely great security posture, but si vous ever besoin to serve anything — a legacy subdomain, an acquired brand, an internal outil — over plain HTTP à nouveau, you’re stuck waiting on navigateur release cycles to reach every utilisateur. Kinsta’s guide puts the operational reality plainly: it peut be a difficult and time-consuming traiter to obtenir votre domain supprimé. Treat preload as permanent.

Pourquoi HSTS is designed to hurt quand choses break

HSTS’s strictness n’est pas a bug — it’s the entier security guarantee. web.dev spells out the tradeoff: “Clients que have listed votre site as a connu HSTS Host are probable to hard-fail si votre site ever has an error in its TLS configuration, (tel as an expired certificate). HSTS is explicitly designed ce façon to garantir que network attackers can’t trick clients into accessing le site sans HTTPS.” (web.dev).

The conclusion Google draws is the sentence I’d tattoo on anyone à propos de to flip ce on: “Don’t enable HSTS jusqu’à you’re certain votre site operation is robust suffisant to éviter ever deploying HTTPS with certificate validation errors.” (web.dev).

“Hard-fail” signifie exactly que: aucun “proceed anyway” lien, aucun click-through. On a normal HTTPS page, an expired cert throws a scary interstitial que a determined utilisateur peut bypass. On an HSTS host, le navigateur refuses outright. So the échec mode of a missed certificate renewal changements category — from “trafic dips parce que personnes are scared off” to “le site is unreachable pour every returning visitor.”

Real-world lockout scenarios

The façons HSTS bites En pratique almost toujours trace back to includeSubDomains or preload getting ahead of votre réel HTTPS coverage:

  • The forgotten subdomain. Vous définir includeSubDomains on example.com, but legacy.example.com (an old app, a status page, a vendor outil) seulement speaks HTTP or has a cert que doesn’t cover it. Every navigateur que saw the header now refuses to charger que subdomain. Nothing modifié on que server — the policy reached bas and broke it.
  • The wildcard-cert gap. A *.example.com wildcard covers foo.example.com but pas foo.bar.example.com (a wildcard is un DNS étiquette deep). Si a deeper subdomain relies on HTTP or a mismatched cert, includeSubDomains locks it out.
  • The expired cert on an HSTS host. Renewal automation fails, the cert lapses, and au lieu de a bypassable warning vous obtenir a site that’s bas pour everyone whose navigateur remembers votre policy — jusqu’à vous obtenir a valid cert back and ils reconnect and recevoir a fresh secure réponse. Là is aucun faster override.
  • Preload regret. Vous preloaded, alors a business besoin forces an HTTP-only service sous the domain. Rolling que back is two separate, non-instant jobs, pas un: serving max-age=0 over HTTPS seulement clears the learned policy pour clients que reconnect avant leur old max-age would’ve expired anyway, pendant que getting the domain out of the preload liste is a distinct submission que encore takes navigateur release cycles — months — to reach utilisateurs, independent of anything vous modifier on votre serveur.
  • Local dev / staging collisions. Preloading example.com with includeSubDomains peut faire dev.example.com or a localhost-style internal host sous the même apex refuse HTTP, breaking local workflows in surprising façons.

None of ces are raisons to éviter HSTS. They’re raisons to stage it: short max-age premier, ajouter includeSubDomains seulement après auditing every subdomain, and reserve preload pour quand you’re certain.

HSTS n’est pas a ranking play (and doesn’t touch canonicalization)

To be clair on the SEO framing: HSTS n’est pas a ranking signal. HTTPS itself is a deliberately tiny un — Google appelé it a “very lightweight signal” affecting fewer que 1% of requêtes — and HSTS is a couche on top of HTTPS, pas a separate ranking input. It aussi doesn’t directement contrôler canonicalization or indexation. Google’s propre documentation is plus spécifique que a flat “doesn’t matter,” though: Google prefers HTTPS as canonical over an equivalent HTTP page except quand there’s an invalid certificate, insecure page dependencies, an HTTPS page que redirections to HTTP, or an HTTP rel="canonical" tag (Google: consolidating duplicate URLs). HSTS ne peut pas fix or override quelconque of que. It’s a browser-side policy with aucun influence on Google’s canonicalization logic — a bad certificate or a broken redirection chain peut encore push Google toward an HTTP canonical regardless of ce que votre HSTS header dit. Canonicalization is driven by votre 301s, votre certificate, votre rel="canonical", and votre lien internes — HSTS earns its placer pour security, utilisateur trust, and closing the SSL-stripping gap — do it pour ceux raisons, garder votre 301s and certificate genuinely solid, and you’ll jamais voir HSTS itself on a rankings report soit façon.

Si you’re running the broader HTTP→HTTPS déplacer, HSTS is the dernier chose vous switch on, pas the premier — it belongs après the migration has settled, as partie of the wider migration de site discipline.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.