Skip to content

Commit

Permalink
Fix x-forwarded-port mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Dec 26, 2016
1 parent 3980756 commit 3b4358b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ http {
'' $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 $http_accept $httpAccept {
default html;
Expand Down Expand Up @@ -196,12 +207,6 @@ http {
ssl_certificate_key {{ $server.SSLCertificate }};
{{ 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) }}
more_set_headers "Strict-Transport-Security: max-age={{ $cfg.HSTSMaxAge }}{{ if $cfg.HSTSIncludeSubdomains }}; includeSubDomains{{ end }}; preload";
{{ end }}
Expand Down

0 comments on commit 3b4358b

Please sign in to comment.