APPLICATION-SECURITY Contents

HTTPS & TLS Realities (HSTS, Termination, Cert Ops)

Run HTTPS correctly in production: termination, proxy headers, HSTS, certificate rotation, and common TLS failure modes with checks.

On this page

Production TLS Reality

Most outages come from termination misconfig, missing proxy headers, expired certificates, or mixed termination layers. Operate TLS as a lifecycle.

Minimum Requirements

  • TLS 1.2+ only (prefer 1.3 where possible)
  • HSTS enabled after confirming HTTPS-only
  • Correct X-Forwarded-Proto and host handling behind proxies
  • Automated certificate renewal with monitoring

Certificate Expiry Checks

# Show cert dates
echo | openssl s_client -connect app.example.com:443 -servername app.example.com 2>/dev/null 
| openssl x509 -noout -dates -subject -issuer

HSTS Rollout

  • Start with short max-age, verify no HTTP dependencies.
  • Then increase max-age gradually.
  • Be careful with preload; it is hard to undo.

Reverse Proxy Gotchas

# If app is behind a proxy, ensure it knows the original scheme
# Otherwise redirects can loop or cookies can lose Secure attribute

# Example header check
curl -sS -D - https://app.example.com/ -o /dev/null | egrep -i "strict-transport-security"

Failure Modes

  • Expired cert: alerts missing; add daily expiry checks.
  • Redirect loops: wrong forwarded proto; fix proxy/app config.
  • Mixed content: browser blocks; enforce HTTPS on all assets.