LW IT Solutions logo LW IT Solutions logo LW IT Solutions
« Blog Overview /IT & Networks/Tutorials / Enforcing HTTPS in the Browser: How HSTS...

Enforcing HTTPS in the Browser: How HSTS Works and Where Its Protection Ends

Enforcing HTTPS in the Browser: How HSTS Works and Where Its Protection EndsEnforcing HTTPS in the Browser: How HSTS Works and Where Its Protection Ends

Management Summary

HSTS tells a browser to use encrypted connections for a website on later visits. It helps prevent a return to an unencrypted route, but applies only to the addresses covered by the rule. A rule received from a www address does not automatically protect the bare domain. Some sites also join a protection list built into browsers, allowing earlier protection. This is a longer-term commitment because removal can take months, and every covered address must keep working securely.

Contents
  1. The host matters, and scope can extend downwards
  2. What the twenty-domain sample recorded
  3. A redirect is not itself HSTS
  4. Preload is a separate decision
  5. The historical finding for this site
  6. A transparent four-response check
  7. Questions and answers
  8. Sources

HSTS tells a browser to require HTTPS for a host while the policy is active. It can prevent an HTTP request from leaving the browser at all. It is not the only mechanism that starts a visit securely: modern browsers can prefer HTTPS for typed addresses, and HTTPS-only settings or a preload entry can already enforce it.

A historical check on 6 September 2026 queried twenty domains at four entry points each: the base host and www, over HTTP and HTTPS. These eighty first-response samples reveal where headers appeared and where redirects pointed. They do not establish the browser’s stored policy, preload membership or the behaviour of every page and subdomain.

Historical first responses: two base-host HSTS records, ten www-only records, eight without a header; eleven same-host HTTPS redirects, eight changed hosts, one retained HTTP. Preload status was not checked.
Saved results from 6 September 2026; first-response headers and browser-enforced policy are separate evidence.

The host matters, and scope can extend downwards

A valid Strict-Transport-Security header is learned from an error-free HTTPS response for the responding host. A header from www.example.com does not establish a policy for example.com. With includeSubDomains, however, the policy also covers descendants: on www that includes a.www.example.com; on the base host it includes www and other subdomains.

This is host scope, not a restriction to one URL path. A header on an HTTPS redirect can establish the policy before the browser follows the Location value. HTTP responses cannot establish HSTS. The max-age duration is counted from receipt and refreshed by later accepted headers; ordinary dynamic HSTS, learned from a website response rather than a browser preload list, is not automatically permanent.

What the twenty-domain sample recorded

Two HTTPS base-host responses contained HSTS: GitHub declared 31,536,000 seconds with includeSubDomains and preload; Allegro declared 15,552,000 seconds, or 180 days, without those flags. Allegro’s response was 403, which does not itself prevent an otherwise valid HSTS header from being processed over valid HTTPS.

Ten records contained HSTS only in the sampled www HTTPS response. Eight contained none in either sampled HTTPS response. “None in these responses” is narrower than “nowhere on the domain”: redirects were not followed, and later paths might send a header. Existing browser policies and preload coverage were not checked.

Eleven initial HTTP base-host responses redirected to HTTPS on the same host. Eight changed to another HTTPS host; this includes Bund redirecting to verwaltung.bund.de, so not all eight targeted www. One Google response redirected to www while retaining HTTP. Three www HTTP samples returned status 200. HEAD retrieves headers without the response body. Because the tool used HEAD, that status does not prove that page content was actually downloaded or that all browsers would use HTTP.

A redirect is not itself HSTS

A same-host HTTP-to-HTTPS redirect creates an opportunity to learn HSTS if the HTTPS response actually carries an acceptable header. The redirect alone establishes no policy. A direct HTTP-base-to-HTTPS-www redirect cannot make a www header apply upwards to the base host. But it also does not prove that every visit began over HTTP: prior policy, preload and browser HTTPS upgrades can change the route.

The assertion that most visitors type the base host was not measured. A private window or a new profile also does not imply an unavoidable plaintext request. The relevant distinction is whether HTTPS is enforced or preferred in that browser before the network request starts.

Preload is a separate decision

A preload entry can supply an HSTS policy before the first visit in a browser that ships that entry. The preload token in a header is not proof of inclusion, and a favourable local check is not proof either. The current hstspreload.org guidance recommends HSTS but does not generally recommend preloading, citing its limited additional benefit alongside modern HTTPS upgrades.

The submission requirements include a valid certificate, HTTPS support for all relevant subdomains including internal ones, and an appropriate base-domain HSTS header: at least 31,536,000 seconds, includeSubDomains and preload. If port 80 is served, the first redirect must go to HTTPS on the same host. An additional redirect from the base HTTPS endpoint must itself carry HSTS.

The historical checker marked one record, GitHub, as ready according to its local tests. It did not test every subdomain or query a preload list. There is no basis for concluding that the other nineteen were absent from all browser lists. Header directives are case-insensitive, so includeSubdomains with a lowercase d is not an error.

Preload inclusion and removal depend on distribution to browsers. Removal is not an immediate rollback; the service describes delays of months and cannot guarantee timing for other browsers. The flag should therefore not be an automatic last step in an HSTS tutorial.

Young apple trees stand planted in a row, while one sapling with the same ribbon still waits in its pot. Likewise, the preload flag alone does not prove a site is on the browsers' preload list.
Young apple trees stand planted in a row, while one sapling with the same ribbon still waits in its pot. Likewise, the preload flag alone does not prove a site is on the browsers' preload list.

The historical finding for this site

The saved first responses for lukaswojcik.com contained no HSTS header. The HTTP base address redirected directly to HTTPS www; the HTTPS www root then redirected to /en/. That final language path was outside the four-response test. This is a dated observation, not a claim that every current response on this site lacks HSTS.

A base-host HTTPS redirect can carry its own policy. Subdomain coverage requires includeSubDomains explicitly; adding a base-host header alone does not cover all subdomains. The historical sample contains no inventory proving the current status of retired or internal hosts.

A transparent four-response check

The following Bash example deliberately makes four HEAD requests without following redirects. The example.com addresses are placeholders. It preserves full headers, reports connection failures and continues through all four entry points. TLS certificate verification remains enabled.

Shell
#!/usr/bin/env bash
set -u
out=$(mktemp -d) || exit 1
failed=0
index=0
for url in http://example.com/ https://example.com/ \
           http://www.example.com/ https://www.example.com/; do
  index=$((index + 1))
  printf '\n%s\n' "$url"
  if curl --silent --show-error --head --proto '=http,https' \
      --connect-timeout 10 --max-time 20 \
      -D "$out/$index.headers" -o /dev/null \
      -w 'status=%{http_code}\n' "$url"; then
    cat "$out/$index.headers"
  else
    printf 'Request failed: %s\n' "$url" >&2
    failed=1
  fi
done
printf '\nSaved first-response headers: %s\n' "$out"
exit "$failed"

HEAD can differ from GET in a particular deployment. A fuller audit follows every relevant redirect with method and host recorded, checks GET responses as needed, validates header syntax, and inspects browser policy and current preload status separately. An HTTP 200, a missing header or a transport failure is not interchangeable evidence.

The HSTS and Preload Readiness Checker provides this initial inventory. The reviewed implementation makes four first-response HEAD probes, not a complete redirect-chain audit. Its readiness label is preliminary, and its simple header parser does not fully validate every malformed or duplicate directive case.

Questions and answers

Why is HSTS ignored over HTTP?

An unauthenticated response could be modified on the network. HSTS is therefore accepted only through a valid secure connection; a header received over HTTP cannot establish or delete the policy.

Does an expired certificate cause an outage for the whole max-age?

No. An active HSTS policy prevents the usual certificate-warning bypass, but repairing the certificate and TLS configuration can restore access immediately. Waiting for policy expiry is not the required remedy. Monitoring certificate renewal remains important for every covered host.

How can deployment proceed gradually?

First, HTTPS and certificate handling must work on the intended hosts. A short policy such as max-age=300 can limit the duration of a new dynamic setting; it does not shorten an already cached longer policy until the browser receives the update. Longer stages require monitoring and time for the previous stage to expire. includeSubDomains needs an inventory of affected hosts. Preloading remains an independent, deliberate decision.

What does max-age=0 remove?

Received over valid HTTPS, it removes that host’s dynamic policy. Simply omitting the header does not remove an existing policy. A parent policy covering subdomains, a separately stored child policy or preload coverage can still require HTTPS. Preload removal follows a separate process.

Must the base host be visited as the main page?

No. A valid HTTPS response from the base host can establish its policy even when obtained as a resource, subject to the browser actually making and processing that request. Preload or an applicable parent policy can also provide coverage. A request to www alone cannot teach the browser an unknown base-host policy.

What happens to explicit HTTP ports?

For a covered host, HSTS upgrades HTTP to HTTPS. An explicit port 80 becomes 443; another explicit port is retained. An HTTP-only service on port 8080 therefore does not automatically move to HTTPS port 443 and may fail after the upgrade.

Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in touch

A question or an idea for a web project? Tell me a little about it. This form uses reCAPTCHA and formconfirmed to protect against spam.

Write a comment

Experience with other hardware or firmware and questions about the configuration are welcome here.

The email address is not published. Required fields are marked with an asterisk.

LUKASWOJCIK.COM · NEWSLETTER

Fresh ideas in your inbox

New articles, practical tools and updates from the projects.

Choose topics (optional)
No selection: all topics.

Subscription starts after confirmation by email. · Privacy

Privacy · Newsletter

Email address, language, selected topics and subscription/confirmation dates are stored to deliver the newsletter. Double opt-in is required. Every issue includes an immediate unsubscribe link. Formconfirmed checks the signup for spam. No email open or click tracking.

Read the full privacy policy ↗