1001Ferramentas
🔒Security

HSTS Header Builder

Assembles a Strict-Transport-Security header line from a max-age in seconds plus optional includeSubDomains and preload directives, ready to paste into a config.

Header

Building the HSTS header without locking yourself out

HSTS instructs the browser to reach that domain over HTTPS only, for as long as the header declares. The gain is closing the first-visit window: without it, someone typing the address without a scheme makes one cleartext request before the redirect, and that request is where a network attack fits.

Choose the duration and the two options and the page assembles the header. The common value is one year, and the reason it runs so long is that the effect only exists for people who already visited — a short window means the browser forgets and the gap reopens. The subdomains option extends the rule to everything beneath the domain, and the preload flag signals intent to join the list built into browsers.

The care required scales with the duration: the header cannot be undone remotely. Shipping it with subdomains included takes down any subdomain still serving plain HTTP — an internal system, an old environment, a forgotten panel — and the browser of anyone who already visited will refuse for a year. The safe practice is shipping with a short duration, confirming everything answers over HTTPS, and only then raising it.

Frequently asked questions

What does the preload flag actually do?
On its own, nothing beyond signalling. The preload list is maintained by the Chromium project and used by the major browsers, and inclusion happens by submitting on a dedicated site. It requires at least a one-year duration, subdomains included, and an HTTP to HTTPS redirect on the apex domain.
Can I get off the preload list?
You can, but it takes months: you request removal and wait for the browser release cycle. Meanwhile the domain keeps demanding HTTPS for everyone. That is why joining the list should be a deliberate decision, not a side effect of copying a header off the internet.
Does the header work over HTTP?
No, deliberately: the browser ignores HSTS received over an insecure connection. If it accepted, an attacker on the network could inject the header with a huge duration and take the site down. That is why it must be sent on the HTTPS response.

Related Tools