Checks / Web and domains

Strict-Transport-Security is missing

Check
http.hsts
Severity
low
Runs
on our side, against a domain you verified
Looks at
HSTS header on the HTTPS answer, max-age at least 180 days
Updated 26 Nov 2026

What the check looks at

Once a day the service requests the home page of the domain over HTTPS and reads the Strict-Transport-Security header. The check fails when the header is missing or when max-age is below 15552000 seconds (180 days).

Why it matters

Without HSTS, a visitor who types example.com or follows an old http:// link sends the first request in plain text. On a hostile network (public Wi-Fi, a compromised router) an attacker can answer that request instead of your server and keep the visitor on HTTP, or read cookies that are not marked Secure. With HSTS, the browser remembers for max-age seconds that the domain is HTTPS-only, rewrites every http:// URL itself, and does not let the visitor click through certificate errors.

A short max-age gives little protection: the browser forgets the rule when it expires, and returning visitors are exposed again.

How to fix it

Add the header to HTTPS responses. Two years (63072000 seconds) is the value in the Mozilla guidelines.

nginx:

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;

Apache httpd (with mod_headers):

Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"

Caddy:

header Strict-Transport-Security "max-age=63072000; includeSubDomains"

Before you add includeSubDomains, make sure every subdomain works over HTTPS, including internal ones such as intranet.example.com; browsers will refuse plain HTTP for all of them. If you are unsure, start with max-age=300, then a week, then a month, and only then two years, as hstspreload.org recommends.

In nginx, an add_header inside a location block replaces all add_header lines from the server block for that location. Repeat the header there, or keep the headers in a file you include.

Also redirect HTTP to HTTPS, so first-time visitors reach the header at all.

How to check the fix

curl -sI https://example.com/ | grep -i strict-transport-security
strict-transport-security: max-age=63072000; includeSubDomains

Check a page served by another location block and an error page as well (curl -sI https://example.com/does-not-exist).

When a warning is fine

  • A domain that must still serve some content over plain HTTP, for example to old devices. Fix that first; HSTS cannot be added safely until then.
  • During a staged rollout with a short max-age. The check passes once you reach 180 days.

Adding preload and submitting the domain to hstspreload.org is optional. It requires max-age of at least one year and includeSubDomains, and removal from browsers takes a long time.

Sources