Docs Security

HSTS header

Checks for a Strict-Transport-Security header with a max-age of at least 180 days, so browsers go straight to HTTPS on every visit.

SecurityWeight 3In reports as hsts

What it checks

We read the Strict-Transport-Security header on the homepage response, after redirects.

The check reads the max-age value, in seconds. It needs at least 15552000 seconds, which is 180 days. includeSubDomains and preload are not required to pass.

Why it matters

Even with a redirect in place, the first request a browser makes to http:// is unprotected, and someone on the network can intercept it before the redirect happens.

HSTS tells the browser to use HTTPS for your domain for the next max-age seconds without asking. After the first visit, the http:// step never happens.

How to fix it

Send the header on HTTPS responses with a max-age of at least 180 days. One year is a common choice.

Browsers remember the setting for the whole max-age, so only send it once HTTPS works across the site. If you are unsure, start with a short max-age, check nothing breaks, then raise it. Add includeSubDomains only when every subdomain works over HTTPS. Preloading is a separate step that is slow to undo.

Platform notes

Cloudflare

Turn on HSTS under SSL/TLS, Edge Certificates, and choose the max-age there.

Nginx and Apache

On Nginx, use add_header with the always flag in the HTTPS server block. On Apache, use Header always set with mod_headers enabled.

Next.js, Vercel and Netlify

Set the header in the headers() function in next.config.js, in vercel.json, or in a Netlify _headers file or netlify.toml.

WordPress

Add it in your server config, through your host, or with a security plugin that can set response headers.

Shopify, Wix, Squarespace and Webflow

These platforms control the response headers on their own hosting, so there is usually no setting for this header in the site editor. If you need it, ask the platform's support what your plan allows.

Your report shows what this check found on your site. Pro shows the exact fix for your site. See pricing.

Questions

What is HSTS preload?

A list built into browsers of domains that always use HTTPS, even on the very first visit. Joining needs includeSubDomains, a long max-age and the preload flag, and leaving takes months, so it is optional and not needed to pass this check.

See what this check finds on your site

Free, about 30 seconds, with every other check included.