Fix the malformed Strict-Transport-Security header on Apache
Why it matters
The header is present but does not follow the required syntax, so browsers ignore it and your site gets no HSTS protection. A small typo such as a missing max-age is enough.
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
- Search for the header (grep -R Strict-Transport-Security /etc/apache2 /var/www/.htaccess) and keep one correct line. Use Header always set everywhere, never append or add. A plain Header set elsewhere (for example in .htaccess) is a separate table in Apache and can leave two headers on the response.
- Run apachectl configtest and reload.
/ etc/ apache2/ sites-available/ site-ssl.conf
Header always set Strict-Transport-Security "max-age=300" Related
- Reported by the HSTS check
- Add the Strict-Transport-Security (HSTS) header
- Re-enable HSTS (max-age is zero)
- Raise the HSTS max-age
- Decide whether to add includeSubDomains
- Meet the HSTS preload requirements or remove preload
- Consider submitting the domain to the HSTS preload list
- Send HSTS on the redirect visitors meet first
Scan your domain to see whether this applies to you.