Caddy Hsts

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up caddy hsts by adding a strict transport header in your server file. This rule tells browsers to use only encrypted HTTPS requests for your web app. Teams often log in to web hosts with broad admin roles to edit these files. Broad host permissions let anyone with server access change TLS rules or read private keys. How caddy hsts works in your web architecture Caddy handles TLS certificates out of the box, which sets up your base HTTPS layer. Still, automatic HTTPS redirects alone d

Hsts: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up caddy hsts by adding a strict transport header in your server file. This rule tells browsers to use only encrypted HTTPS requests for your web app. Teams often log in to web hosts with broad admin roles to edit these files. Broad host permissions let anyone with server access change TLS rules or read private keys.

How caddy hsts works in your web architecture

Caddy handles TLS certificates out of the box, which sets up your base HTTPS layer. Still, automatic HTTPS redirects alone do not stop the very first insecure browser request. When you turn on caddy hsts, the server sends a special response header to clients. Browsers read this header and remember to use HTTPS for a set period of time.

Even if a user types a plain HTTP address, the browser swaps it to HTTPS. This swap happens inside the browser before any packet leaves the local network. You can also extend this rule to cover all subdomains under your main domain name. Teams often test with a short cache time before they commit to a long duration. A bad TLS rule on a sub-app can lock users out until the timer expires.

What native transport headers solve and what they leave open

Strict transport headers protect users from network downgrade attacks and rogue Wi-Fi hotspots. They make sure client browsers talk to your web server over an encrypted channel. This setup solves network snooping between the public user and your front-end web tier.

Still, transport headers do nothing to control how your own engineers manage the server itself. To update server rules, engineers usually open a shell session or edit host files directly. Native server access checks only verify who logs in at the start of a session. Once inside the host, an engineer can run any command or read sensitive app data. A simple typo in a server command can break TLS for every app on that host. Native SSH keys also stay on laptops and give standing access to the whole machine. Teams lack a clear audit log of which person changed a header or read a key. You need command-level controls and data masking when engineers debug live web servers and databases. Masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results.

Hsts: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for testing transport security rules

Start your rollout with a short expiration window so you can fix broken subdomains fast. Check every legacy service on your domain to confirm it has a valid TLS certificate. Watch your browser error reports before you ask public preload lists to save your domain. Keep your server changes in version control so you know when header rules change. Limit who can run shell commands on the hosts that hold your TLS keys.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Does Caddy turn on HSTS by default when it gets a certificate?

No, the server sets up HTTPS redirects by default, not the strict transport header. You must add the response header rule yourself so browsers cache the HTTPS policy.

Why did my subdomain stop working after I updated the main domain header?

Your header rule likely included an instruction that applies the policy to all subdomains. Any subdomain without a valid TLS certificate will fail to load in the browser.

How do I undo a strict transport rule if a web app breaks?

You can set the header age to zero over an active HTTPS session to clear it. Users must visit the working HTTPS site once to receive the new zero-age rule.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.