diff --git a/docs/configuration/nginx.md b/docs/configuration/nginx.md index fd7bf6db4..ed8007079 100644 --- a/docs/configuration/nginx.md +++ b/docs/configuration/nginx.md @@ -174,11 +174,8 @@ server { {{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }} upstream {{ $.APP }}-{{ $upstream_port }} { -{{ range $listeners := $.DOKKU_APP_LISTENERS | split " " }} -{{ $listener_list := $listeners | split ":" }} -{{ $listener_ip := index $listener_list 0 }} -{{ $listener_port := index $listener_list 1 }} - server {{ $listener_ip }}:{{ $listener_port }};{{ end }} +{{ range $listener_ip := $.DOKKU_APP_LISTENERS | split " " }} + server {{ $listener_ip }}:{{ $upstream_port }};{{ end }} } {{ end }} ``` diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index b41a69921..3e22c1a5d 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -219,10 +219,8 @@ nginx_build_config() { shopt -s nullglob local DOKKU_APP_IP_FILE for DOKKU_APP_IP_FILE in $DOKKU_ROOT/$APP/IP.web.*; do - local DOKKU_APP_PORT_FILE="${DOKKU_APP_IP_FILE//IP/PORT}" local DOKKU_APP_LISTENER_IP=$(< "$DOKKU_APP_IP_FILE") - local DOKKU_APP_LISTENER_PORT=$(< "$DOKKU_APP_PORT_FILE") - local DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT " + local DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP " done local DOKKU_APP_LISTENERS="$(echo "$DOKKU_APP_LISTENERS" | xargs)" shopt -u nullglob diff --git a/plugins/nginx-vhosts/templates/nginx.conf.sigil b/plugins/nginx-vhosts/templates/nginx.conf.sigil index 50df0aae6..104f8ea70 100644 --- a/plugins/nginx-vhosts/templates/nginx.conf.sigil +++ b/plugins/nginx-vhosts/templates/nginx.conf.sigil @@ -115,10 +115,7 @@ server { {{ if $.DOKKU_APP_LISTENERS }} {{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }} upstream {{ $.APP }}-{{ $upstream_port }} { -{{ range $listeners := $.DOKKU_APP_LISTENERS | split " " }} -{{ $listener_list := $listeners | split ":" }} -{{ $listener_ip := index $listener_list 0 }} -{{ $listener_port := index $listener_list 1 }} - server {{ $listener_ip }}:{{ $listener_port }};{{ end }} +{{ range $listener_ip := $.DOKKU_APP_LISTENERS | split " " }} + server {{ $listener_ip }}:{{ $upstream_port }};{{ end }} } {{ end }}{{ end }} diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 2614c284d..47f37fd23 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -302,10 +302,7 @@ server { {{ if $.DOKKU_APP_LISTENERS }} {{ range \$upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }} upstream {{ $.APP }}-{{ \$upstream_port }} { -{{ range \$listeners := $.DOKKU_APP_LISTENERS | split " " }} -{{ \$listener_list := \$listeners | split ":" }} -{{ \$listener_ip := index \$listener_list 0 }} -{{ \$listener_port := index \$listener_list 1 }} +{{ range \$listener_ip := $.DOKKU_APP_LISTENERS | split " " }} server {{ \$listener_ip }}:{{ \$upstream_port }};{{ end }} } {{ end }}{{ end }} @@ -349,10 +346,7 @@ server { {{ if $.DOKKU_APP_LISTENERS }} {{ range \$upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }} upstream {{ $.APP }}-{{ \$upstream_port }} { -{{ range \$listeners := $.DOKKU_APP_LISTENERS | split " " }} -{{ \$listener_list := \$listeners | split ":" }} -{{ \$listener_ip := index \$listener_list 0 }} -{{ \$listener_port := index \$listener_list 1 }} +{{ range \$listener_ip := $.DOKKU_APP_LISTENERS | split " " }} server {{ \$listener_ip }}:{{ \$upstream_port }};{{ end }} } {{ end }}{{ end }}