check for VIRTUAL_IP env

This commit is contained in:
Adrian Harabula 2022-01-08 15:19:49 +02:00
parent 53ef90a2f6
commit e9d693aee5

View file

@ -175,6 +175,11 @@ upstream {{ $upstream_name }} {
# /!\ Virtual port not exposed
{{ end }}
{{ end }}
{{ if (eq $container.Env.VIRTUAL_IP "127.0.0.1") }}
{{ $server_found = "true" }}
## Detected host proxy port forward
server {{ $container.Env.VIRTUAL_IP }}:{{ $container.Env.VIRTUAL_PORT }};
{{ else }}
{{ range $knownNetwork := $CurrentContainer.Networks }}
{{ range $containerNetwork := $container.Networks }}
{{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }}
@ -206,6 +211,7 @@ upstream {{ $upstream_name }} {
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{/* nginx-proxy/nginx-proxy#1105 */}}
{{ if (eq $server_found "false") }}
# Fallback entry