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.
Know what rollback can clear
A valid HTTPS response with max-age=0 clears that host’s learned policy only for clients that receive it. Removing the header or sending it over HTTP does not clear a cached policy. A child cannot opt out of a parent’s still-active includeSubDomains, and clearing a parent does not delete policies independently learned for children.
Scope follows the host that sends the header: policy from www.example.test covers that host and, with includeSubDomains, its descendants, not the sibling api.example.test or the parent example.test. Keep HTTPS working during recovery. Preload removal is a separate browser-update process, not an immediate response-header rollback.
Sources
- RFC 6797 — HTTP Strict Transport Security, policy processing and scope, checked 2026-10-15.
- MDN:
Strict-Transport-Security, directives and deployment cautions, checked 2026-10-15. - HSTS preload program, submission requirements and removal constraints, checked 2026-10-15.