What is HSTS, and does my website need it?
HTTP Strict Transport Security (HSTS) tells browsers to reach your website only over HTTPS for a set time. Your site sends the rule in a Strict-Transport-Security response header. While a browser holds the rule, it upgrades http:// requests for your hostname to https:// before sending them, and it does not let visitors click past certificate errors. If every page of your site already works over HTTPS, you should send it.
What the Shield scan checks
HSTS, worth 10 of 100 points. Shield requests your HTTPS home page, follows up to four HTTPS redirects and reads the headers of the final response. The check passes if the first number Shield finds right after max-age= in the Strict-Transport-Security header is at least 15,552,000 seconds (180 days), so write it as plain digits without quotes. That threshold is Shield's own; the HSTS standard sets no minimum.
If the check fails, the scan tells you: Send Strict-Transport-Security with a max-age of at least 180 days.
What the header looks like
Strict-Transport-Security: max-age=31536000; includeSubDomains
- max-age is how many seconds the browser keeps the rule. 31,536,000 seconds is one year, the minimum for new preload submissions.
- includeSubDomains applies the rule to every subdomain too, so add it only when all of them work over HTTPS.
- preload is optional and not part of the HSTS standard itself. It only signals that you intend to join the preload list built into browsers; you still submit the domain at hstspreload.org, and every covered subdomain must then stay on HTTPS. hstspreload.org itself recommends HSTS but not preloading for most sites.
Browsers ignore the header when it arrives over plain HTTP, and when the HTTPS connection has certificate errors (RFC 6797, section 8.1).
Why a redirect is not enough
When a browser opens your site over plain http://, for example from an old link, that first request is not encrypted. An attacker on the same network, such as public Wi-Fi, can intercept it before your redirect arrives and keep the visitor on an unencrypted connection. This is called a protocol downgrade. A browser that holds your HSTS rule never sends that plain request.
How to switch it on in safe stages
- Make sure every page loads over HTTPS and that http:// requests redirect to https://. If you plan to cover subdomains, check that they all work over HTTPS too.
- Follow the staged rollout on hstspreload.org: send the header on every HTTPS response with includeSubDomains and a max-age of
300(five minutes), then604800(one week), then2592000(one month). At each stage, check for broken pages and wait the full max-age before moving on. Leave out includeSubDomains if you are not covering subdomains. - Then set your long-term value: at least 15,552,000 (180 days) to pass the Shield check, or at least 31,536,000 (one year) if you plan to submit for preload.
- Add preload only after reading the submission requirements on hstspreload.org, because coming off the list is slow.
Where you set the header depends on your host: the hosting control panel, your CDN or your web server configuration. Some hosts send it for you. Ask your host or developer to check the response headers before and after each change. On 27 November 2026, this website sent max-age=63072000, which is two years.
Check your HSTS now
Type your website address to run the free scan. It checks this and the other 10 items. No account, no email.
The interactive scan needs JavaScript. See the checks you can run yourself.
Questions
Do I need HSTS if my site already redirects HTTP to HTTPS?
Yes. A redirect only arrives after the browser has sent a plain http:// request, and that request can be intercepted. A browser that holds your HSTS rule upgrades the request itself, so there is no plain request to intercept.
What max-age should I use?
Start with a few minutes while you test, then raise it in stages. To pass the Shield scan it must be at least 15,552,000 seconds (180 days). To join the HSTS preload list it must be at least 31,536,000 seconds (one year).
Can HSTS break my website?
Yes, if a page or a covered subdomain does not work over HTTPS. Each valid header restarts the browser's timer, and while the rule applies visitors cannot bypass certificate errors. To withdraw it, send max-age=0 over valid HTTPS; browsers that receive it clear that hostname's rule, though a parent domain's rule that covers subdomains can still apply. Removal from the preload list is a separate, slow process.
Does HSTS protect the very first visit?
Only if the browser already has a rule that covers the hostname, for example from its built-in preload list or from a parent domain whose rule covers subdomains. Otherwise the browser learns the rule when it first receives a valid HSTS header over an error-free HTTPS connection, so that first request is not protected.
Sources
- RFC 6797: HTTP Strict Transport Security (HSTS)
- MDN: Strict-Transport-Security header
- OWASP: HTTP Strict Transport Security Cheat Sheet
- hstspreload.org: HSTS preload list, deployment advice and submission requirements
Written by Apex Flow Labs LLC for Apex Flow Shield. A score of 100 means the responses Shield received passed all 11 of its checks. It does not prove each setting is configured well, and no scan can show that a website cannot be attacked.