what is the purpose of max-age in HSTS ? such as:
Strict-Transport-Security: max-age=100
If the value exceeds 100, what will happen ?
is there any best practice of setting the max-age ?
thanks !
what is the purpose of max-age in HSTS ? such as:
Strict-Transport-Security: max-age=100
If the value exceeds 100, what will happen ?
is there any best practice of setting the max-age ?
thanks !
There are semantically distinct ways to send HSTS headers, as defined in RFC 6797:
Strict-Transport-Security: max-age=31536000
The HSTS policy is applied only to the domain of HSTS host issuing it and remains in effect for one year.
Strict-Transport-Security: max-age=31536000; includeSubDomains
The HSTS policy is applied to the domain of the issuing host as well as its subdomains and remains in effect for one year.
Strict-Transport-Security: max-age=0
Directs the browser to delete the entire HSTS policy.
HSTS Best Practices
There are a few simple best practices for HSTS:
includeSubDomain
directive in the policy definition whenever possible. The directive’s presence ensures the HSTS policy is applied to the domain of the issuing host and all of its subdomains, e.g. example.com
and www.example.com
.This cheat sheet from OWASP might help you out in future too.