Fix x-forwarded-port mapping

This commit is contained in:
Manuel de Brito Fontes 2016-12-26 10:56:22 -03:00
parent 39807569a2
commit 3b4358b861

View file

@ -108,6 +108,17 @@ http {
'' $scheme; '' $scheme;
} }
map $http_x_forwarded_port $pass_server_port {
default $http_x_forwarded_port;
'' $server_port;
}
# map port 442 to 443 for header X-Forwarded-Port
map $pass_server_port $pass_port {
442 443;
default $pass_server_port;
}
# Map a response error watching the header Content-Type # Map a response error watching the header Content-Type
map $http_accept $httpAccept { map $http_accept $httpAccept {
default html; default html;
@ -196,12 +207,6 @@ http {
ssl_certificate_key {{ $server.SSLCertificate }}; ssl_certificate_key {{ $server.SSLCertificate }};
{{ end }} {{ end }}
# map port 442 to 443 for header X-Forwarded-Port
map $pass_port $server_port {
442 443;
default 80;
}
{{ if (and (not (empty $server.SSLCertificate)) $cfg.HSTS) }} {{ if (and (not (empty $server.SSLCertificate)) $cfg.HSTS) }}
more_set_headers "Strict-Transport-Security: max-age={{ $cfg.HSTSMaxAge }}{{ if $cfg.HSTSIncludeSubdomains }}; includeSubDomains{{ end }}; preload"; more_set_headers "Strict-Transport-Security: max-age={{ $cfg.HSTSMaxAge }}{{ if $cfg.HSTSIncludeSubdomains }}; includeSubDomains{{ end }}; preload";
{{ end }} {{ end }}