Skip to content

Commit

Permalink
Splitted x-forwarded-host/host mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
paovitali committed Feb 25, 2019
1 parent b47350e commit 64dcdc5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rootfs/etc/nginx/template/nginx.tmpl
Expand Up @@ -305,6 +305,17 @@ http {
'' $server_port;
}

# Obtain best http host
map $http_host $this_host {
default $http_host;
'' $host;
}

map $http_x_forwarded_host $best_http_forwarded_host {
default $http_x_forwarded_host;
'' $this_host;
}

{{ else }}
map '' $pass_access_scheme {
default $scheme;
Expand Down Expand Up @@ -1249,7 +1260,7 @@ stream {
{{ else }}
{{ $proxySetHeader }} X-Forwarded-For $the_real_ip;
{{ end }}
{{ $proxySetHeader }} X-Forwarded-Host $best_http_host;
{{ $proxySetHeader }} X-Forwarded-Host $best_http_forwarded_host;
{{ $proxySetHeader }} X-Forwarded-Port $pass_port;
{{ $proxySetHeader }} X-Forwarded-Proto $pass_access_scheme;
{{ if $all.Cfg.ProxyAddOriginalURIHeader }}
Expand Down

0 comments on commit 64dcdc5

Please sign in to comment.