Multiple HSTS headers

Although the HTTP Strict Transport Security (HSTS) RFC (RFC6797) allows for multiple HSTS headers to be present:

"If a UA receives more than one STS header field in an HTTP response message over secure transport, then the UA MUST process only the first such header field."

this could be problematic, leading to unexpected behaviour, and is therefore flagged as invalid by certain vulnerability scanners.
This is often the result of a reverse proxy in front of an application setting the HSTS header in addition to the one already set by the application itself. In Apache HTTPD this could be the case when a directive such as this is used:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

If the reverse proxy is the one controllling the HSTS header the duplicity can be fixed removing the existing header before adding it:

Header onsuccess unset Strict-Transport-Security
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"


Comments

Popular posts from this blog

Decoding OCSP GET requests

Signing a CSR with an Enrollment Agent certificate

Compacting an AD CS database