Short answer
HSTS works by storing a site's Strict-Transport-Security header so the browser uses HTTPS for that host until max-age runs out. RFC 6797 defines the policy. MDN says later HTTP visits are upgraded and certificate warnings cannot be clicked through. The preload directive is not in that RFC. The Chromium preload site documents it separately.
Last verified against the sources listed below.
Key takeaways
- RFC 6797 defines HSTS as a policy declared with the Strict-Transport-Security header.
- max-age is required and counts seconds. A value of 0 clears the stored policy.
- includeSubDomains is optional and extends the policy to subdomains.
- MDN says the browser will not let you bypass a certificate error on an HSTS host.
- hstspreload.org says HSTS preloading is not recommended, even though HSTS is.
How HSTS works is a memory in the browser. The site sends one response header over HTTPS. The browser remembers that this host should be opened with HTTPS, for the number of seconds the header names.
That memory is part of website security. It does not encrypt the bytes by itself. Encryption is the HTTPS connection. HSTS is the rule that keeps the browser on that connection.
How does HSTS work?
The browser has to see the header before the rule exists. RFC 6797 says an HSTS host must not include the STS header field in responses sent over non-secure transport. The first copy that counts is the one that arrives on HTTPS.
MDN describes the result. The header tells the browser that the host should only be accessed using HTTPS, and that future attempts to use HTTP should be upgraded to HTTPS. On later connections, the browser will not allow the user to bypass secure connection errors, such as an invalid certificate.
The stored record is the host name. MDN says HSTS identifies a host by its domain name only. A path, a query string, or a single article does not get a separate policy.
How the internet works is the backdrop: the browser asks for a host, a server answers, and the answer can include this header. The next ask for the same host is where the stored rule changes the URL.
What is the HSTS meaning?
RFC 6797’s abstract is the definition. It specifies a mechanism that lets web sites declare themselves accessible only via secure connections, and lets users direct their user agent to interact with given sites only over secure connections. That policy is called HTTP Strict Transport Security, or HSTS.
The policy is declared by the Strict-Transport-Security HTTP response header, or by other means such as user agent configuration. A header is the common case. A preload list, covered later, is a configuration that ships inside the browser.
The IETF datatracker lists RFC 6797 as a Proposed Standard from November 2012. That is the same memo as the text file cited here.
HSTS meaning, in short, is “remember HTTPS for this host.” It is not a rating of the site, and it is not a promise that the page content is true.
What is an HSTS policy?
The header has directives. RFC 6797 says max-age is required. It is the number of seconds, after the browser receives the header, during which the browser regards the host as a known HSTS host.
A max-age of 0 tells the browser to stop regarding the host as a known HSTS host. That is the off switch in the RFC, not a second header name.
includeSubDomains is optional. If it is present, the policy applies to the host and to subdomains of the host’s domain name. RFC 6797’s examples use max-age=31536000 for about one year on the issuing host only, and max-age=15768000 with includeSubDomains for about six months on the host and its subdomains.
MDN writes the same directives, and it adds a third token, preload, which it marks optional and non-standard. The RFC text opened here does not define that token.
| Directive | Where it is defined | What it does |
|---|---|---|
| max-age | RFC 6797, required | Seconds to remember the host |
| includeSubDomains | RFC 6797, optional | Cover subdomains too |
| preload | MDN, non-standard | Asks to be listed, with extra rules |
| max-age=0 | RFC 6797 note | Forget the stored policy |
Send the header on HTTPS responses only. A policy that never gets stored cannot upgrade the next visit.
What is HSTS preload?
Preload exists because of the first visit. Until a browser has seen the header, it does not yet have a stored policy. hstspreload.org says Chrome keeps a list of domains that are HTTPS-only, built into Chrome. Other major browsers have used preload lists based on that Chrome list.
The same page says many browsers now upgrade HTTP navigations to HTTPS on their own. It says preloading only adds value when those upgrades fail in the presence of an active attacker. Its plain advice is that HSTS is recommended and HSTS preloading is not recommended.
If you still submit, the site’s requirements are specific. max-age must be at least 31536000 seconds, which it calls 1 year, and includeSubDomains must be present.
The preload directive must be present too. Subdomains must work over HTTPS, including internal names that are not public. The example header on the page is max-age=63072000; includeSubDomains; preload.
MDN matches the minimum: when you use preload, max-age must be at least 31536000 and includeSubDomains must be present. The page also says not to turn preload on by default in a project template, because removal is slow when a subdomain cannot do HTTPS.
What is an HSTS error?
MDN’s error behavior is the one to remember. Once the policy is stored, the browser will not allow the user to bypass a secure connection error. A bad certificate, a name that does not match, or a failed HTTPS connection is not a click-through warning anymore.
That feels like a broken site if you expected the old “proceed anyway” button. The button is gone because the policy says this host is HTTPS-only. Fix the certificate or the server. Do not tell readers to clear the policy as the first step, unless you meant to retire HTTPS and you sent max-age=0 over a still-valid HTTPS response.
A header that was sent only on HTTP never starts this state. RFC 6797 forbids that send. If a test client shows no policy, check that the response you inspected was HTTPS.
What to check before you ship the header
Turn the lifetime up in stages if the host has many names. hstspreload.org’s own ramp, even when you are not preloading, is a practical order: a short max-age, then a longer one, after you have watched for broken names.
Start with the host you actually serve. Add includeSubDomains only after every name under that domain answers on HTTPS. The preload site is explicit that internal names count.
Keep the certificate valid for the whole max-age you advertise. A year-long policy plus an expired certificate is the error MDN describes: the browser will not offer a bypass.
Files on that host should still be small. An image compressor shrinks an image before you serve it on the HTTPS host the policy pins. Compression does not create the header, and it does not shorten max-age.
Frequently asked questions
What is an HSTS website?
An HSTS website is a host that has sent a valid Strict-Transport-Security header over HTTPS, or that a browser already treats as HTTPS-only because of its own configuration. RFC 6797 calls that host an HSTS host once the policy is noted. The name is the domain, not the page path. MDN says HSTS identifies a host by its domain name only. One article on the site does not get its own policy. The host does, and includeSubDomains can widen that to names under it.
What is the HSTS protocol?
HSTS is not a new transport the way TLS is a transport. RFC 6797 defines a policy that a site declares, mainly with an HTTP response header. The header is Strict-Transport-Security. The required directive is max-age. includeSubDomains is optional. Browsers that understand the header change how they open later URLs for that host. You still need HTTPS to serve the header in the first place. The policy does not replace the certificate or the TLS handshake.
What is HSTS network behavior?
The browser enforces the policy on the client. hstspreload.org describes what that changes for an on-path observer. If a user clicks an HTTP link and HSTS is already stored, the browser upgrades the URL to HTTPS, so the path is not sent in the clear. A redirect from HTTP to HTTPS can be rewritten by an attacker if the browser has never stored the policy. HSTS is the memory that stops the repeat of that first plain request. It is not a firewall rule on the router.
What is HSTS security?
hstspreload.org names three problems HSTS is meant to shrink once the browser enforces the policy. An on-path observer can see an HTTP URL, can rewrite an HTTP-to-HTTPS redirect, and can see or inject cookies on HTTP. After the policy is stored, the browser upgrades those HTTP URLs. MDN adds that the user cannot click through a secure-connection error such as a bad certificate. The pages do not give a count of attacks stopped. They describe the mechanism.
What is an HSTS vulnerability?
The documented footgun is scope, not a secret bug number. includeSubDomains and preload apply to subdomains, including internal names that may not have HTTPS. hstspreload.org says people enable preload by default and then find a subdomain that cannot serve HTTPS. Removal is described as slow. RFC 6797 also forbids sending the STS header over non-secure transport. A header that never arrives over HTTPS does not create the policy. Test the real subdomains before you set a long max-age.
Sources
- RFC 6797, HTTP Strict Transport Security · IETF, 2012
- Strict-Transport-Security header · MDN, 2026
- HSTS preload list submission · Chromium, 2026