Merge pull request #5971 from Juice-de-Orange/fix/hsts-subdomains-per-host

fix: apply the HSTS sub-domains setting per host
This commit is contained in:
jc21 authored and GitHub committed 2026-11-05 09:58:02 +10:00
commit 2a8b39bdef
2 files changed
+10 -3

No files matched your search

+5 -1
View File
@@ -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 %}
+5 -2
View File
@@ -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";
}