HTTP Strict Transport Security tells a supporting browser to use HTTPS for a host during a cached period. That persistence is the feature and the risk: removing the header does not immediately erase policy already stored by clients.
Verify the HTTPS path first
Before sending HSTS, confirm that the canonical hostname serves a valid certificate and that HTTP redirects to the intended HTTPS URL without depending on user input:
curl -sS -D - -o /dev/null --max-redirs 0 http://www.example.test/
curl -sS -D - -o /dev/null https://www.example.test/
Check representative deep routes and error pages. HSTS cannot repair a certificate error because the browser requires a valid HTTPS connection before accepting the policy.
Start with a short max-age
A staged rollout limits the recovery window while configuration is new:
Strict-Transport-Security: max-age=300
After observing the site and renewal path, increase the duration deliberately. Record the date, chosen value, and rollback conditions. A final policy might use a year, but the number is a commitment rather than a scanner score.
Treat includeSubDomains as a separate decision
includeSubDomains extends policy to every subdomain. Inventory names first, including old services, delegated zones, and hostnames used only on internal networks. One HTTP-only descendant is enough to make the option disruptive for clients that received the parent policy.
Preload is not ordinary header configuration
Browser preload programs can distribute policy outside the normal response cycle. Their requirements and removal delays are stricter than setting a header. Do not request preload merely because a scanner recommends it; confirm long-term ownership of the domain and all covered names.
Verify the public response
curl -sS -D - -o /dev/null https://www.example.test/ \
| awk 'tolower($1) == "strict-transport-security:" { print }'
Test the canonical public edge, not only an origin port. Proxies may add, remove, or duplicate the header.
Sources
- RFC 6797 — HTTP Strict Transport Security, policy processing and scope, checked 2026-08-23.
- MDN:
Strict-Transport-Security, directives and deployment cautions, checked 2026-08-23.