forward published port set by PORT_HTTP and PORT_HTTPS
This commit is contained in:
parent
619943ac1e
commit
6a2f8c7fcd
1 changed files with 10 additions and 1 deletions
11
nginx.tmpl
11
nginx.tmpl
|
|
@ -24,11 +24,20 @@ map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
||||||
'' $scheme;
|
'' $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Set $docker_port to published port using PORT_HTTP or PORT_HTTPS
|
||||||
|
{{ $httpPort := coalesce $.Env.PORT_HTTP "80" }}
|
||||||
|
{{ $httpsPort := coalesce $.Env.PORT_HTTPS "443" }}
|
||||||
|
map $scheme $docker_port {
|
||||||
|
default $server_port;
|
||||||
|
http {{ $httpPort }};
|
||||||
|
https {{ $httpsPort }};
|
||||||
|
}
|
||||||
|
|
||||||
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
|
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
|
||||||
# server port the client connected to
|
# server port the client connected to
|
||||||
map $http_x_forwarded_port $proxy_x_forwarded_port {
|
map $http_x_forwarded_port $proxy_x_forwarded_port {
|
||||||
default $http_x_forwarded_port;
|
default $http_x_forwarded_port;
|
||||||
'' $server_port;
|
'' $docker_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
|
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue