webzod
account

Re-enable HSTS (max-age is zero) on nginx

tls.hsts.disabled · effort: minutes

Why it matters

A max-age of zero tells browsers to forget HSTS, so the site is sending the header but gaining no protection from it. It is often left over from a rollback.

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. Find the add_header line that sets max-age=0 (grep -R Strict-Transport-Security /etc/nginx) and change the value. Test with nginx -t and reload.
  2. Raise max-age in the stages from the generic steps (86400, then 2592000, then 31536000), reloading and checking with curl -sI each time.
/etc/nginx/conf.d/site.conf
add_header Strict-Transport-Security "max-age=300" always;

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.