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 we request the home page of the domain over HTTPS (following redirects on the same host) and read the Strict-Transport-Security header. The check fails when the header is missing, and warns when max-age is missing or below 15552000 seconds (180 days).

Risk

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 it in place 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 http:// URLs itself, and does not let the visitor click through certificate errors. When a short max-age runs out, returning visitors are exposed again.

How to fix it

Add the header to HTTPS responses. The Mozilla guidelines use two years (63072000 seconds).

nginx

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

An add_header inside a location block replaces all add_header lines of the server block there; repeat the header, or keep the headers in a file you include.

Apache httpd

With mod_headers:

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

Caddy

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

With includeSubDomains, browsers refuse plain HTTP for every subdomain, internal ones such as intranet.example.com included; check them first. If you are unsure, start with max-age=300, then a week, then a month, then two years, as hstspreload.org recommends. Also redirect HTTP to HTTPS, so that first-time visitors get the header.

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; until then, HSTS cannot be added safely.
  • A staged rollout with a short max-age. The check passes from 180 days on.

preload and a submission to hstspreload.org are optional; they require a max-age of at least one year and includeSubDomains, and removal from browsers takes a long time.

Sources