HTTP Strict Transport Security (HSTS)
RFC 6797, published by the IETF, defines the Strict-Transport-Security response header field: a host declares that user agents must reach it only over secure transport, for a number of seconds, optionally for all its subdomains. With this skill the agent configures the header and the HTTP-to-HTTPS redirect on a server, rolls the policy out safely, decides on preloading, implements the user agent rules, or reviews an existing deployment.
Follow the workflow below step by step. Every rule here comes from a source in Sources, with the section it cites. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: deployer (a server, CDN, proxy or framework that sends the header), user agent (an HTTP client that enforces it), or reviewer.
- Target version: RFC 6797 (default, and the only line). No legacy line and no preview exist. See
references/versions.md. - Revision: the pinned revision in Sources, unless the user names another.
- Sources: when refreshing this skill or when a rule looks out of date, re-read every URL in Sources first, check the RFC Editor entry for RFC 6797 for an updating or obsoleting RFC and for new errata, re-read the hstspreload.org requirements, and update the pins.
- Host inventory: the apex domain, every subdomain and nested subdomain (including internal ones that are not publicly reachable), and any plain-HTTP service on them, such as CRL or OCSP endpoints.
- Preload intent: none (default), or a deliberate, long-term plan to submit the apex to the preload list.
- HTTPS DNS records: whether the zone publishes, or plans to publish, HTTPS resource records (RFC 9460).
Invariants
- Only over secure transport. An HSTS Host MUST NOT send
Strict-Transport-Securityin responses over non-secure transport (§ 7.2), and a user agent MUST ignore the header on a response received over insecure transport (§ 8.1). max-ageis required. Its value is delta-seconds, optionally quoted (§ 6.1.1, § 6.2).includeSubDomainsis optional and valueless (§ 6.1.2).- Well-formed header, one of each. Every directive appears at most once, names are case-insensitive, and order does not matter (§ 6.1). User agents MUST ignore a header that does not conform to the grammar, and MUST ignore unrecognized directives while processing the recognized ones (§ 6.1).
- One header field per response. If the host sends the header, it MUST send only one (§ 7.1); a user agent that receives several MUST process only the first (§ 8.1).
max-age=0deletes the policy, includingincludeSubDomains, andincludeSubDomainsis ignored whenmax-ageis zero (§ 6.1.1, § 6.2, § 8.1). For an unknown host, the user agent MUST NOT note it (§ 8.1).- Error-free transport only. A user agent notes or updates a Known HSTS Host only when the response came over secure transport with no errors or warnings (§ 8.1, § 14.3).
- Domain names only. A host addressed by an IP literal or IPv4 address MUST NOT be noted (§ 8.1.1), and such URIs never match a Known HSTS Host (§ 8.3).
- Policy belongs to the issuing host. A user agent MUST NOT change the expiry or
includeSubDomainsof a superdomain-matched Known HSTS Host (§ 8.1.1); only the issuing host can update or delete its policy (§ 5.3). - Upgrade before loading. For a Known HSTS Host, the user agent MUST rewrite
httptohttpsbefore loading, including when following redirects; explicit port 80 becomes 443, any other explicit port is kept, and no port is added (§ 8.3). - No recourse on transport errors. When connecting to a Known HSTS Host, the user agent MUST terminate the connection on any secure transport error or warning, including certificate validation errors (§ 8.4); the user should not be offered a way to proceed (§ 12.1).
- Header field only. User agents MUST NOT heed
<meta http-equiv="Strict-Transport-Security">(§ 8.5). - A missing header does not remove the policy. The user agent keeps the host as a Known HSTS Host until
max-ageruns out (§ 8.6), and MUST evict expired entries (§ 8.1.1). preloadis not part of RFC 6797. It is a convention of the preload list (hstspreload.org); RFC 6797 user agents ignore it as an unrecognized directive (§ 6.1).
Workflow
- Pick the version. Use RFC 6797; it is the only line.
->
references/versions.md✓ Documentation and code cite RFC 6797, and nothing claims an RFC definespreload. - Inventory hosts and decide on
includeSubDomains. List every subdomain and plain-HTTP service. WithoutincludeSubDomains, domain cookies are not protected (§ 14.4); with it, any subdomain without working HTTPS becomes unreachable (§ 11.4.1, § 14.5). ->references/deployment-and-preload.md✓ Every subdomain serves valid HTTPS, orincludeSubDomainsis left off and the reason is recorded. - Send the header on HTTPS responses. Emit one well-formed header on every HTTPS response, at every entry point users reach directly, such as both the apex and
www(§ 7.1, § 11.4.2). ->references/header-and-server.md✓ Each entry point returns exactly oneStrict-Transport-Securityheader over HTTPS, including on its redirects. - Redirect HTTP to HTTPS. Answer plain-HTTP requests with a permanent redirect to the
httpsform of the effective request URI, and no HSTS header (§ 7.2, § 9). ->references/header-and-server.md✓http://requests get a 301 (or another permanent redirect) tohttps://, with noStrict-Transport-Securityon the HTTP response. - Roll out
max-agein stages. Start small (300 seconds), then one week, then one month, waiting out each stage and fixing breakage before raising it; ship configuration defaults ofmax-age=0(hstspreload.org; § 11.2). ->references/deployment-and-preload.md✓ The current stage, its start date and the date it may advance are recorded. - Decide on preloading (optional). Preload only after a full rollout, with a long-term commitment to HTTPS on every subdomain; never turn on
preloadby default. ->references/deployment-and-preload.md✓ Eitherpreloadis absent, or the apex meets every submission requirement and the owner accepted that removal takes months. - Implement user agent processing (user agent role). Parse, note, match, upgrade and enforce per § 8, and treat HTTPS RRs as an HSTS-like upgrade signal when supported (RFC 9460 § 9.5).
->
references/user-agent-processing.md✓ Tests cover congruent and superdomain matching, port mapping,max-age=0, duplicate headers, IP literals and transport errors. - Review security. Check the deployment against the bootstrap, time, denial-of-service, cookie and tracking considerations.
->
references/security.md✓ Every consideration is addressed or knowingly accepted. - Roll back (only when needed). Send
max-age=0over HTTPS from the same host; for a preloaded domain, also request removal from the list. ->references/deployment-and-preload.md✓ The HTTPS responses carrymax-age=0and HTTPS stays up until clients have seen it. - Upgrade (only when asked). There is no older line to upgrade from; refresh the pins and check for an RFC that updates RFC 6797.
->
references/versions.md✓ The pins are current and the RFC Editor shows no successor, or the skill is updated to it.
Verify before done
- HTTPS responses carry exactly one
Strict-Transport-Securityheader with amax-agedirective, and each directive appears once (§ 6.1, § 7.1). - Plain-HTTP responses redirect permanently to
httpsand carry no HSTS header (§ 7.2). - The header is sent at every well-known entry point, not only on a host that redirects elsewhere (§ 11.4.2).
- With
includeSubDomains, every subdomain, including internal ones, serves valid HTTPS (§ 11.4, § 14.5). -
max-agewas raised in stages, and configuration defaults aremax-age=0(§ 11.2). -
preloadis sent only with a deliberate preload plan, amax-ageof at least 31536000 andincludeSubDomains(hstspreload.org). - No
<meta http-equiv>HSTS is relied on (§ 8.5). - User agents: IP literals are never noted, superdomain entries are never modified, and transport errors end the connection with no click-through (§ 8.1.1, § 8.4).
Reference index
references/versions.md: the RFC 6797 line, its errata, whypreloadand HTTPS RRs have no version line, and the refresh steps. Load for steps 1 and 10.references/header-and-server.md: the header grammar, directives, examples, server processing over HTTPS and HTTP, the effective request URI and common mistakes. Load for steps 3 and 4.references/user-agent-processing.md: noting, storing, matching, upgrading and enforcing policy, IDNA, and how HTTPS RRs (RFC 9460) relate. Load for step 7.references/deployment-and-preload.md:includeSubDomainsplanning, expiry strategy, the staged rollout, preload requirements and removal, and rollback. Load for steps 2, 5, 6 and 9.references/security.md: the threat model and every RFC 6797 security consideration, with what to do about each. Load for step 8.
Related skills
content-security-policyfor upgrading or blocking insecure subresource loads on HTTPS pages:npx skills add ScaleDockHQ/scaledock-skills --skill content-security-policy.http-cookiesfor theSecureattribute and domain cookies that HSTS withincludeSubDomainsprotects:npx skills add ScaleDockHQ/scaledock-skills --skill http-cookies.http-semanticsfor redirect status codes, theLocationfield and header field rules:npx skills add ScaleDockHQ/scaledock-skills --skill http-semantics.
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- RFC 6797: HTTP Strict Transport Security (HSTS): RFC (Proposed Standard), RFC 6797 (November 2012), checked 2026-10-05.
- RFC 6797 errata: RFC Editor errata list, 5 reports, all rejected, checked 2026-10-05.
- HSTS Preload List Submission: web page (no version), requirements for domains submitted on or after 2017-10-11, checked 2026-10-05.
- RFC 9460: Service Binding and Parameter Specification via the DNS (SVCB and HTTPS Resource Records): RFC (Proposed Standard), RFC 9460 (November 2023), checked 2026-10-05.