TLS & PKI

What is HSTS?

Also known as: HTTP Strict Transport Security

Definition

HTTP Strict Transport Security (HSTS) is a web security policy mechanism that forces browsers to interact with a website only over HTTPS, preventing downgrade attacks and cookie hijacking.

HSTS (HTTP Strict Transport Security) is a response header that instructs browsers to enforce HTTPS-only connections to a given domain for a specified duration. When a server sends the Strict-Transport-Security header, the browser records the policy and automatically upgrades any subsequent HTTP requests to HTTPS. It refuses to connect over plaintext HTTP and does not allow users to bypass certificate warnings for that domain. The header includes a mandatory max-age directive, measured in seconds, and an optional includeSubDomains flag that extends the policy to all subdomains.

How it works: The browser caches the HSTS policy after the first HTTPS response that includes the header. For the duration of max-age, any attempt to access the domain via HTTP is internally rewritten to HTTPS before a request is sent. If the HTTPS connection fails due to a certificate error, the browser displays a hard error and blocks the connection. This prevents man-in-the-middle attacks that try to downgrade a connection from HTTPS to HTTP, such as SSL stripping. HSTS also supports preloading: domains can be submitted to browser vendors to be hardcoded into the browser, so the policy is active even before the first visit.

Where it sits in the stack: HSTS operates at the application layer, working alongside TLS and HTTPS. It is a policy mechanism enforced by the user agent, not a protocol extension. It is part of a broader set of security headers that includes Content Security Policy and X-Frame-Options. HSTS is defined in RFC 6797 and is widely supported in all major browsers. It is a critical tool for protecting users on networks where attackers might intercept unencrypted traffic.

Key facts

  • Defined in RFC 6797 (HTTP Strict Transport Security).
  • Uses the Strict-Transport-Security response header with a max-age directive in seconds.
  • Optional includeSubDomains flag applies the policy to all subdomains.
  • Preloading allows domains to be hardcoded into browsers for first-connection protection.
  • Prevents SSL stripping and other downgrade attacks by enforcing HTTPS only.

How it works in practice

A user types example.com into the browser address bar. If the browser has an HSTS policy for example.com (either from a previous visit or from a preloaded list), it automatically sends an HTTPS request to https://example.com instead of HTTP. An attacker on the same Wi-Fi network cannot intercept the initial HTTP request because it never happens. If the server's certificate is invalid, the browser blocks the connection entirely, preventing the user from accidentally accepting a fraudulent certificate.

Related terms

HTTPS TLS SSL HTTP Public Key Infrastructure (PKI) Certificate Authority (CA) Content Security Policy (CSP)

References

More in TLS & PKI

ACME Protocol

ACME (Automated Certificate Management Environment) is a protocol that automates the issuance, renewal, and revocation of TLS certificates, defined in RFC 8555.

Certificate Authority

A Certificate Authority (CA) is a trusted entity that issues digital certificates after verifying that the requester controls the domain or identity named in the certificate.

Certificate Chain

A certificate chain is an ordered list of certificates, starting with the server certificate and ending with a root CA, that a client validates to establish trust in the server's identity.

Certificate Pinning

A security technique where an application trusts only a specific, pre-selected certificate or public key for a given server, bypassing the standard chain of trust.

Cipher Suite

A cipher suite is a named set of cryptographic algorithms negotiated during a TLS handshake, specifying key exchange, authentication, encryption, and integrity protection for secure communications.

Domain Validation

Domain Validation (DV) is the lowest level of certificate validation used in TLS/SSL, where the certificate authority verifies only that the applicant controls the domain name, typically via an HTTP or DNS challenge.

ECH

Encrypted Client Hello (ECH) is a TLS extension that encrypts the Client Hello message, including the Server Name Indication (SNI), to prevent on-path observers from learning the target hostname during the handshake.

Extended Validation

Extended Validation (EV) is the highest level of TLS certificate assurance, requiring the certificate authority to perform rigorous, human-verified checks on the legal identity and operational existence of the requesting organization before issuance.

Intermediate Certificate

An intermediate certificate is a subordinate CA certificate signed by a root CA, used to sign end-entity certificates and enable path validation while the root remains offline.

Let's Encrypt

Let's Encrypt is a free, automated, public certificate authority operated by the Internet Security Research Group (ISRG) that issues short-lived Domain Validation (DV) TLS certificates via the ACME protocol.

Who Is Online

In total there are 63 users online: 0 registered, 55 guests and 8 bots.

Most users ever online was 5,555 on 17 Jul 2026, 3:23 am.

Bots: AhrefsBot Applebot Baiduspider Bingbot Other Bot Other Crawler PetalBot SemrushBot

Users active in the past 15 minutes. Total registered members: 369