SECURITY & PRIVACYAI-REVIEWED

How does HSTS keep a browser on HTTPS?

Useful first: HTTP · optional, not a requirement

Choose your depth

Stay with the essentials, or look closer.

Simple explanation
2 min read · estimate

YOUR GOALDistinguish a browser's HTTPS-only rule from encryption and a server redirect.

Remember to use HTTPS

A rule about the connection

HTTPS protects HTTP traffic using a secure connection. HSTS adds a browser rule: require HTTPS for this host. It does not supply encryption or install a certificate. The server must already support secure access.

[4] [5]

Upgrade before the request

Suppose your browser already knows the HSTS policy for shop.example. Opening http://shop.example/cart becomes an HTTPS request before an insecure request is sent. An ordinary server redirect instead needs a request to reach the server first.

[3] [4]

The first visit is different

A fresh browser may not yet know that policy. Learning it from a later HTTPS response cannot protect an earlier HTTP request. A built-in preload entry can supply advance knowledge. Browsers may also upgrade requests through separate HTTPS-first features; those are not proof that HSTS was learned.

[3] [4]
THE IDEA TO KEEP

A remembered HTTPS-only rule can avoid the insecure request that precedes a redirect.

ONE THING TO WATCH OUT FOR

HSTS is another name for HTTPS encryption.

HTTPS secures the exchange; HSTS tells the browser to require secure access.

A QUICK CHECK, NOT A TEST
The browser knows shop.example is an HSTS host. What happens to an HTTP link?
Show the explanation

It upgrades the URL before sending an insecure HTTP request. The known policy changes the request before it reaches the server. Transport protection does not certify the site's content.

Progress is saved only in this browser.

KEEP EXPLORINGHTTPS
Was this explanation clear?
Report a mistake by email
Basic explanation
2 min read · estimate

YOUR GOALInterpret max-age and subdomain coverage without treating the header as a one-time switch.

Read the policy and its lifetime

Accept the rule securely

A teaching example is Strict-Transport-Security: max-age=86400; includeSubDomains. Delivered over valid HTTPS, it asks the browser to remember the rule for 86,400 seconds: one day. A header received over insecure HTTP is ignored. This example explains syntax, not a production rollout plan.

[1] [2]

A moving expiry time

Receiving the same policy again restarts its lifetime from that receipt. Omitting the header later does not erase a stored policy. A securely received max-age=0 removes that host's stored policy; it does not turn off HTTPS itself.

[1] [2]

Subdomains inherit coverage

With includeSubDomains, a policy for example.com also covers login.example.com. The child cannot cancel the parent's coverage with its own zero lifetime. Check HTTPS readiness across subdomains before enabling this scope; a child's separately learned policy can also outlive the parent's policy.

[2] [3]
THE IDEA TO KEEP

Lifetime and domain coverage determine which stored rules still apply.

ONE THING TO WATCH OUT FOR

Removing the header immediately clears every browser's HSTS state.

A browser can retain its previously received policy until expiry.

A QUICK CHECK, NOT A TEST
Yesterday's one-day HSTS policy has not expired. Today's HTTPS response omits the header. What follows?
Show the explanation

The existing policy can remain until its stored expiry. An absent header does not revoke stored state. Expiry still matters; receiving a new policy can change it.

Progress is saved only in this browser.

KEEP EXPLORINGHTTPS
Was this explanation clear?
Report a mistake by email
Advanced explanation
2 min read · estimate

YOUR GOALReason about first-contact protection and failure cases without assuming HSTS repairs a server.

Preloading, ports and hard failures

A header token is not a deployed preload entry

Preloading distributes HTTPS-only knowledge with browser software. Merely adding preload does not prove inclusion in a reader's browser list. Submission, inclusion and browser updates are separate steps. As checked on 22 November 2026, the preload service recommends HSTS but does not recommend preloading; removal can take time.

[3] [4]

Ports do not all become 443

For a known HSTS host, http://api.example:80/status becomes https://api.example:443/status. But http://api.example:8080/status keeps port 8080 after the scheme changes. That port must support HTTPS. Without an explicit port, the rewritten HTTPS URL uses its default, 443.

[2] [5]

A certificate problem remains a problem

If establishing TLS to a known HSTS host produces a certificate error, the browser fails the connection instead of offering the ordinary click-through exception. HSTS cannot renew a certificate or restore an unavailable server. The secure connection still has to succeed before HTTP requests can be exchanged.

[1] [5]
THE IDEA TO KEEP

Strict transport enforcement can expose broken HTTPS; it cannot repair it.

ONE THING TO WATCH OUT FOR

HSTS makes any certificate acceptable because HTTPS is mandatory.

Requiring secure access also means refusing a connection that fails its security checks.

A QUICK CHECK, NOT A TEST
An HSTS-protected URL explicitly uses port 8080. What does the upgrade require?
Show the explanation

Keep port 8080 and use HTTPS there. The special port rewrite is 80 to 443. Other explicit ports remain, so HTTPS must work on the selected port.

Progress is saved only in this browser.

KEEP EXPLORINGHTTPS
Was this explanation clear?
Report a mistake by email
GO STRAIGHT TO THE SOURCE

Keep asking. Check the details.

Source-checked using AI (OpenAI Codex) on . The checks covered sources, examples, and quizzes for this article version.

No human review is claimed. AI review can miss errors; check the original sources below.

  1. MDN — Strict-Transport-Security header
  2. IETF — RFC 6797: HTTP Strict Transport Security
  3. Chromium HSTS preload service — behavior and deployment limits
  4. Chromium — HTTP Strict Transport Security
  5. IETF — RFC 9110: HTTPS URI scheme
How explanations are prepared