HSTS is one of those security headers where the wrong value is worse than no value. Set max-age=63072000; includeSubDomains; preload on day one and a customer site is locked to HTTPS for two years on every browser that has ever visited it — including subdomains you forgot existed. The careful rollout takes three weeks and ends in a better outcome.
What’s happening
HSTS is an HTTP response header (Strict-Transport-Security) that tells the browser to upgrade every future request for this host to HTTPS, for the duration of max-age. includeSubDomains extends the policy to every subdomain. preload opts the domain into the Chrome HSTS preload list, which is effectively permanent. The browser does not honor downgrades. If you ship HSTS and then later need to serve HTTP for a subdomain, you cannot.
How to verify
curl -I https://example.com/ | grep -i strict-transport
openssl s_client -connect example.com:443 < /dev/null 2>&1 | grep -i transport
grep -ri "Strict-Transport-Security" /home/<user>/public_html/.htaccess
dig +short example.com
If you see a Strict-Transport-Security header on the response, HSTS is already active. Note the max-age and whether includeSubDomains is present.
The fix
- Audit subdomains first: list every domain and subdomain on the account (
whmapi1 fetch_domains user=<user>). If even one of them legitimately needs HTTP (an old IoT device, a partner integration), do not useincludeSubDomains. - Phase 1 (week 1): add
Header always set Strict-Transport-Security "max-age=300"in the per-account.htaccess(or vhost include). Five minutes. Watch the site for issues — there should be none. - Phase 2 (week 2): extend to
max-age=86400(one day). Confirm no customer complaints. - Phase 3 (week 3): extend to
max-age=31536000(one year). At this point, browsers will refuse to load HTTP for a full year after each visit. No turning back without aging out the policy. includeSubDomainsonly after step 1’s audit confirms every subdomain serves HTTPS now and forever.preloadonly when you have confirmed step 5 and have submitted to hstspreload.org. Preload is effectively permanent.- Document the policy in the customer-facing handover doc. Future operators must know HSTS is on; the alternative is a debugging mystery.
Stack Harbor deploys HSTS phased across managed accounts under WHM server management.