mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-11-22 03:56:43 +00:00
fix: apply the HSTS sub-domains setting per host
_hsts_map.conf defined $hsts_header with the host's own value in every host config. A map is global to nginx, so one definition won for all hosts and the "HSTS Sub-domains" switch of the others was ignored. Define two fixed maps instead and let _hsts.conf pick one per host. They get new names, so configs generated before this change, which still define $hsts_header, can't override them. The maps keep HSTS limited to https. Fixes #5947
This commit is contained in:
1 parent
1aca775cb9
commit
076c522ccc
2 files changed
+10
-3
No files matched your search
@@ -2,7 +2,11 @@
|
||||
{% if ssl_forced == 1 or ssl_forced == true %}
|
||||
{% if hsts_enabled == 1 or hsts_enabled == true %}
|
||||
# HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
|
||||
add_header Strict-Transport-Security $hsts_header always;
|
||||
{% if hsts_subdomains == 1 or hsts_subdomains == true %}
|
||||
add_header Strict-Transport-Security $hsts_header_subdomains always;
|
||||
{% else %}
|
||||
add_header Strict-Transport-Security $hsts_header_plain always;
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -1,3 +1,6 @@
|
||||
map $scheme $hsts_header {
|
||||
https "max-age=63072000;{% if hsts_subdomains == 1 or hsts_subdomains == true -%} includeSubDomains;{% endif %} preload";
|
||||
map $scheme $hsts_header_plain {
|
||||
https "max-age=63072000; preload";
|
||||
}
|
||||
map $scheme $hsts_header_subdomains {
|
||||
https "max-age=63072000;includeSubDomains; preload";
|
||||
}
|
||||
Reference in new issue
Block a user