Skip to content

Commit 3b4358b

Browse files
committed
Fix x-forwarded-port mapping
1 parent 3980756 commit 3b4358b

File tree

1 file changed

+11
-6
lines changed
  • controllers/nginx/rootfs/etc/nginx/template

1 file changed

+11
-6
lines changed

controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl

+11-6
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ http {
108108
'' $scheme;
109109
}
110110

111+
map $http_x_forwarded_port $pass_server_port {
112+
default $http_x_forwarded_port;
113+
'' $server_port;
114+
}
115+
116+
# map port 442 to 443 for header X-Forwarded-Port
117+
map $pass_server_port $pass_port {
118+
442 443;
119+
default $pass_server_port;
120+
}
121+
111122
# Map a response error watching the header Content-Type
112123
map $http_accept $httpAccept {
113124
default html;
@@ -196,12 +207,6 @@ http {
196207
ssl_certificate_key {{ $server.SSLCertificate }};
197208
{{ end }}
198209

199-
# map port 442 to 443 for header X-Forwarded-Port
200-
map $pass_port $server_port {
201-
442 443;
202-
default 80;
203-
}
204-
205210
{{ if (and (not (empty $server.SSLCertificate)) $cfg.HSTS) }}
206211
more_set_headers "Strict-Transport-Security: max-age={{ $cfg.HSTSMaxAge }}{{ if $cfg.HSTSIncludeSubdomains }}; includeSubDomains{{ end }}; preload";
207212
{{ end }}

0 commit comments

Comments
 (0)