webzod
account

Raise the HSTS max-age on nginx

tls.hsts.short_max_age · effort: minutes

Why it matters

A short HSTS lifetime means browsers forget the HTTPS-only rule quickly, so visitors who return later are exposed again. A lifetime of at least six months, and ideally one year, keeps them protected.

Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.

The fix

  1. Change the value of the existing add_header line (grep -R Strict-Transport-Security /etc/nginx), test with nginx -t and reload.
  2. Check with curl -sI https://example.com/ that the new value is sent, and watch for problems before any further increase.
/etc/nginx/conf.d/site.conf
add_header Strict-Transport-Security "max-age=31536000" always;

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.