On this page
- Key Takeaways
- How HSTS changes navigation
- Diagnose HSTS redirecting HTTP to HTTPS after a domain change
- 1. Check the HTTP response without following redirects
- 2. Compare with a fresh browser profile
- 3. Inspect HTTPS headers and policy scope
- Preload and changes to HSTS
- Common Mistakes
- Best Practices
- Conclusion
After a domain change, an http:// address may become https:// before a visitor reaches your server. That can happen because of HSTS, but a server redirect, browser HTTPS-first setting, extension, or cached redirect can produce a similar result. Use the checks below to distinguish them before changing security settings.
Key Takeaways
- HSTS can make a browser upgrade an HTTP URL locally, without first requesting it over HTTP.
- A server-side redirect requires an HTTP request and a redirect response, typically with a
Locationheader. - Compare a fresh browser profile with a non-following HTTP request, but account for preloaded policies, inherited subdomain policies, proxies, and browser settings.
- Make sure HTTPS and the certificate work for every affected hostname before changing or expanding HSTS.
How HSTS changes navigation
A website can send a Strict-Transport-Security response header over HTTPS. A browser that accepts the policy remembers to use HTTPS for that host for the policy's specified duration. If the policy includes subdomains, it can also apply to hostnames below it.
When HSTS applies, the browser upgrades an HTTP navigation before sending the request. The address bar ultimately shows HTTPS, and your HTTP endpoint may receive no request for that navigation. Developer tools may show an internal upgrade or redirect, but its presentation depends on the browser; it is not necessarily a response from your server.
By contrast, with a server-side redirect, the client first requests the HTTP URL. The server or an intermediary then responds with a redirect status and a Location header pointing to HTTPS. The visitor ultimately sees HTTPS in either case, so the address bar alone cannot distinguish them.
Advertisement
Diagnose HSTS redirecting HTTP to HTTPS after a domain change
Use a public, non-sensitive test path on a hostname you control. Record the exact hostname: example.com, www.example.com, and app.example.com can have different policies and server configurations.
1. Check the HTTP response without following redirects
From a terminal with curl installed, replace the example URL with your actual HTTP test URL:
curl -q -v --max-time 15 -o /dev/null 'http://www.example.com/health'
The command does not use -L, so curl will not follow a redirect. The -q option prevents a default curl configuration file from silently changing the test. Verbose output includes response headers; avoid sharing logs containing sensitive URLs or headers.
Look for the first response status and any Location header:
- An HTTP redirect to HTTPS demonstrates that the endpoint reached by curl, or an intermediary in its path, is redirecting the request. Inspect the CDN, load balancer, reverse proxy, and application as applicable.
- An HTTP response that is not a redirect suggests that a browser-only upgrade or another client-side behavior may be involved. It does not prove HSTS by itself.
- A timeout or connection failure means the test is inconclusive; check network access, DNS, the HTTP listener, and firewall rules.
Check whether curl is using a proxy and whether the browser follows the same network path. DNS answers, CDN configuration, and network interception can also make the two clients reach different endpoints. An HTTP status-checking service may be useful as a separate observation, but it can have different network and redirect-following behavior too.
2. Compare with a fresh browser profile
Create a new browser profile, open developer tools with network recording enabled, and enter the same HTTP URL directly. Do not visit the HTTPS site in that profile first: doing so could install a policy before the comparison. A private window is not necessarily equivalent to a fresh profile for this purpose.
Compare the address bar and network record with the curl result. If curl receives an ordinary HTTP response but the browser upgrades before an HTTP request appears, investigate HSTS alongside HTTPS-first settings, extensions, and other client-side behavior. If both clients receive an HTTP redirect, investigate the server path first. A cached redirect, service worker, page script, or HTML redirect can also complicate a browser trace.
A fresh profile reduces previously stored site state; it does not rule out a policy built into the browser or a policy inherited from a parent domain. Browser behavior and network-panel labels vary. If you control the test environment, repeat with HTTPS-first features and extensions disabled, then compare results without weakening a normal user's browser configuration.
3. Inspect HTTPS headers and policy scope
Request the HTTPS URL separately, again without following redirects:
curl -q -v --max-time 15 -o /dev/null 'https://www.example.com/health'
Check each HTTPS response in the relevant navigation chain for Strict-Transport-Security. A policy received over a valid HTTPS connection may be stored for that response's hostname. An includeSubDomains directive extends that hostname's policy to its descendants; it does not extend a subdomain's policy to its parent or sibling hostnames.
For example, a policy on example.com that includes subdomains can affect www.example.com and app.example.com. A policy on www.example.com does not by itself cover app.example.com. Check the old and new hostnames separately, including any shared parent: a DNS or domain migration does not by itself transfer a stored host policy to an unrelated hostname.
The HTTPS header you see now is only part of the evidence. A browser may still have a previously learned policy, an applicable parent policy, or a built-in policy even if the current response has no HSTS header.
Advertisement
Preload and changes to HSTS
Some browsers use HSTS preload lists, so a fresh profile may still upgrade a listed host or a host covered by a listed parent. List contents, inclusion rules, removal processes, and browser rollout behavior can change. Before publication or a production change, consult the current HSTS specification and the official documentation for each affected browser, and verify the relevant preload-list status and removal procedure. Those sources and the current list were not available for verification in this article; do not assume that removing a response header immediately removes a built-in policy.
Stopping the header also does not immediately erase a previously stored policy. A host can send Strict-Transport-Security: max-age=0 over valid HTTPS to ask a browser to remove that host's stored policy. This does not remove a policy inherited from a parent or necessarily override a built-in preload entry. It also requires the browser to reach that host successfully over HTTPS and receive the response.
Treat removal as a security change, not a quick diagnostic fix. Test the exact recovery plan in a controlled environment and expect clients with different stored state to behave differently.
Common Mistakes
- Treating every HTTPS navigation as a server redirect. Capture the first HTTP response and inspect the browser's network record.
- Testing only the new hostname. A parent policy may cover it, while the old hostname may have its own stored policy.
- Assuming a fresh profile eliminates every HSTS policy. A browser's built-in policy or a parent policy can still apply.
- Removing HSTS before HTTPS is ready. Affected visitors may already be forced to use HTTPS; removing the header does not instantly change their stored state.
- Treating curl as a complete browser simulation. This command checks the HTTP response on curl's network path, not all browser policy or state.
Best Practices
Before migration, inventory the old and new hostnames and their parent-domain policies. Provision and test valid certificates and HTTPS routing for every affected hostname, including redirects and error paths. Check from representative networks and browsers before enabling or expanding an HSTS policy, especially one covering subdomains.
Keep a rollback plan that accounts for previously stored and potentially preloaded policies. Monitor both HTTP and HTTPS endpoints, but remember that an HSTS upgrade may never appear in HTTP access logs. Use authorized, non-sensitive test URLs when collecting diagnostics.
Conclusion
Start with a non-following HTTP request, then compare it with a fresh browser profile and inspect the HTTPS headers and parent-domain scope. The comparison narrows the cause without assuming that every HTTPS navigation is an HSTS upgrade or a server redirect.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.