---
title: "HSTS"
description: "HSTS forces browsers to use HTTPS. The max-age, includeSubDomains and preload directives, the first-visit gap and how to enable it safely."
language: "en"
locale: "en-US"
type: "definition"
canonical: "https://www.wp-feint.com/glossary/hsts/"
published: "2026-10-28T08:00:00+00:00"
modified: "2026-11-22T12:07:34+00:00"
translations:
  en-US: "https://www.wp-feint.com/glossary/hsts/index.md"
  fr-FR: "https://www.wp-feint.com/fr/definitions/hsts/index.md"
  es-ES: "https://www.wp-feint.com/es/glosario/hsts/index.md"
  de-DE: "https://www.wp-feint.com/de/glossar/hsts/index.md"
  it-IT: "https://www.wp-feint.com/it/glossario/hsts/index.md"
  pt-BR: "https://www.wp-feint.com/pt/glossario/hsts/index.md"
  nl-NL: "https://www.wp-feint.com/nl/woordenlijst/hsts/index.md"
---

# HSTS

HSTS (HTTP Strict Transport Security) is an HTTP header that tells the browser to contact a site only over HTTPS for a set period of time. After the first secure visit, any HTTP URL is converted to HTTPS before the request is sent, and certificate errors can no longer be bypassed.

HSTS was standardized in November 2012 by RFC 6797. Its goal is to close a gap that a plain HTTP-to-HTTPS redirect leaves open: as long as a visitor types `example.com` without specifying the protocol, their browser starts with an unencrypted request. On public Wi-Fi, an attacker in the middle can intercept that request and keep the victim on HTTP, an attack known as SSL stripping. With HSTS, the browser remembers that the site requires HTTPS and no longer even tries the unencrypted version.

## How HSTS works

The server adds the `Strict-Transport-Security` header to its HTTPS responses. There are three directives:

- `max-age` (required): how long, in seconds, the browser remembers the instruction;
- `includeSubDomains`: applies the rule to every subdomain;
- `preload`: signals that the domain agrees to be added to the browsers' preload list.

```
Strict-Transport-Security: max-age=31536000; includeSubDomains
```

The RFC mandates two important behaviors. First, a browser ignores the header if it arrives over HTTP, so that a middleman can neither add nor strip it. Second, on an HSTS site, any [TLS certificate](https://www.wp-feint.com/glossary/tls-certificate/) error cuts the connection: the user no longer gets a button to “proceed anyway.”

![Three-column table: on the first visit, the initial HTTP request remains exposed before the redirect and the header arrive; on later visits, the browser switches to HTTPS on its own and blocks certificate errors; with the preload list, HTTPS applies from the very first visit but removal takes months](https://www.wp-feint.com/media/2026/10/hsts-premiere-visite-en-1.webp)

## The first visit and preloading

HSTS has a weakness acknowledged by both MDN and the RFC: it only applies after a first successful secure connection. To close that gap, Chrome maintains a list of domains hard-coded into the browser, which Firefox, Safari and Edge also rely on. The `hstspreload.org` site requires a valid certificate, a redirect from HTTP to HTTPS, every subdomain on HTTPS and a header with a `max-age` of at least 31536000 seconds (one year), `includeSubDomains` and `preload`. It warns that inclusion is hard to undo and that removal takes months to reach users.

*Video: “HSTS - HTTP Strict Transport Security - Protect against SSL Stripping attack - Practical TLS” (Practical Networking)*

## For WordPress

WordPress doesn't send HSTS by itself. Before enabling it, make sure the whole site runs on [HTTPS](https://www.wp-feint.com/glossary/tls-ssl/): URLs under Settings, General, mixed content fixed, automatic certificate renewal (often handled by [Let's Encrypt](https://www.wp-feint.com/glossary/lets-encrypt/) at your host). Our guide to HTTPS on WordPress walks through these steps.

1. Start with a short `max-age` (300 seconds, then one week), without `includeSubDomains`.
2. Check every subdomain (webmail, staging, extranet) before adding `includeSubDomains`.
3. Go up to one year once everything is stable; request preloading only as the very last step.
4. Set the header in a single place (server, CDN or plugin) to avoid two conflicting values.

HSTS is one of the [security headers](https://www.wp-feint.com/glossary/http-security-headers/) that audit tools check. Its effect on SEO is indirect, as explained in the article [HTTPS, HSTS and what Google actually takes into account](https://www.wp-feint.com/https-security-headers-seo-trust/).

## Common mistakes

- Enabling a year of HSTS with `includeSubDomains` while a subdomain is still on HTTP: it becomes unreachable for visitors who received the header.
- Assuming you can roll back by turning the option off: to disable HSTS, you have to send `max-age=0` over HTTPS, which requires a certificate that is still valid.
- Letting the certificate expire: with HSTS, visitors can no longer click through the warning.

WP Feint Pro offers HSTS as an option in its [Security headers](https://www.wp-feint.com/features/security-headers/) card, with a one-year `max-age`, never sent over HTTP. The interface reminds you that browsers keep remembering the header even after it is disabled: only turn it on for a site that will stay on HTTPS for good.

## Related terms

- [TLS / SSL](https://www.wp-feint.com/glossary/tls-ssl/)
- [TLS certificate](https://www.wp-feint.com/glossary/tls-certificate/)
- [HTTP security headers](https://www.wp-feint.com/glossary/http-security-headers/)
- [Let's Encrypt](https://www.wp-feint.com/glossary/lets-encrypt/)
- [Content Security Policy (CSP)](https://www.wp-feint.com/glossary/content-security-policy/)


## Sources

- [RFC 6797 : HTTP Strict Transport Security (HSTS)](https://www.rfc-editor.org/rfc/rfc6797)
- [MDN : Strict-Transport-Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security)
- [HSTS Preload List Submission](https://hstspreload.org/)
