VibeSecurity

Web attacks

What is HSTS (HTTP Strict Transport Security)?

HSTS is a response header that tells browsers to use only HTTPS for your site for a set time, automatically upgrading plain HTTP requests and blocking users from clicking through certificate warnings.

Even if your site supports HTTPS, a first visit over plain HTTP can be intercepted on public Wi-Fi and redirected somewhere hostile. HSTS closes that gap: once a browser has seen the header, it refuses to talk to your domain over HTTP until the timer runs out.

Hosting platforms often give you HTTPS but not this header, and AI-generated projects rarely set it. The header only works over HTTPS, and it is a commitment. If you enable it for subdomains or preload before every subdomain supports HTTPS, visitors can be locked out of those pages.

Begin with a short max-age, confirm everything works, then raise it to a year. Add includeSubDomains only when all subdomains are HTTPS, and add preload only when you are certain, because removal from preload lists is slow.

One-year policy
Strict-Transport-Security: max-age=31536000; includeSubDomains

Related terms

Sources

  1. 1.MDN: Strict-Transport-Security