-
Notifications
You must be signed in to change notification settings - Fork 2k
HSTS header is sent multiple times #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is a way to do that. In the http context add the following map: map $upstream_http_strict_transport_security $hsts {
"" "value from config map or annotation";
default $upstream_http_strict_transport_security;
}
In the server context: proxy_hide_header Strict-Transport-Security; # this will remove the hsts header if it's present in the response
add_header Strict-Transport-Security $hsts; Not sure if it's necessary though as duplicated headers are allowed in the RFC. |
@pleshakov |
It's valuable feature to have regardless of the hsts feature. To make it complete, it's better to add support for http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass_header directive.
What do you think about replacing of the original header by default? If the user doesn't want it, the user must turn off the hsts feature. |
Ok, I will add this to #88
I would like this, but the solution with the |
without the map, just replacing altogether proxy_hide_header Strict-Transport-Security;
add_header Strict-Transport-Security "something" always; |
@pleshakov |
@thetechnick |
The current implementation of hsts may sent the header multiple times, if the backend application is already adding it to the http response.
This should not break clients as stated in #67, which is true for browsers.
But if the site is tested using https://www.ssllabs.com for example a error message is shown:
"Server sent invalid HSTS policy. See below for further information."
"Strict Transport Security (HSTS) Invalid Server provided more than one HSTS header "
Maybe we can find a way to add the header only if it does not exist already?
The text was updated successfully, but these errors were encountered: