mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
fix: add proto to VIRTUAL_HOST_MULTIPORTS
This commit is contained in:
parent
691724c81f
commit
9bd84fc95e
26
nginx.tmpl
26
nginx.tmpl
@ -589,18 +589,31 @@ proxy_set_header Proxy "";
|
|||||||
|
|
||||||
{{- range $path, $vpath := $vhost }}
|
{{- range $path, $vpath := $vhost }}
|
||||||
{{- if (empty $vpath) }}
|
{{- if (empty $vpath) }}
|
||||||
{{- $vpath = dict "dest" "" "port" "default" }}
|
{{- $vpath = dict
|
||||||
|
"dest" ""
|
||||||
|
"port" "default"
|
||||||
|
"proto" "http"
|
||||||
|
}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $dest := $vpath.dest | default "" }}
|
{{- $dest := $vpath.dest | default "" }}
|
||||||
{{- $port := $vpath.port | default "default" | toString }}
|
{{- $port := $vpath.port | default "default" | toString }}
|
||||||
|
{{- $proto := $vpath.proto | default "http" }}
|
||||||
|
|
||||||
{{- $path_data := get $paths $path | default (dict) }}
|
{{- $path_data := get $paths $path | default (dict) }}
|
||||||
{{- $path_ports := $path_data.ports | default (dict) }}
|
{{- $path_ports := $path_data.ports | default (dict) }}
|
||||||
{{- $path_port_containers := get $path_ports $port | default (list) | concat $containers }}
|
{{- $path_port_containers := get $path_ports $port | default (list) | concat $containers }}
|
||||||
{{- $_ := set $path_ports $port $path_port_containers }}
|
{{- $_ := set $path_ports $port $path_port_containers }}
|
||||||
{{- $_ := set $path_data "ports" $path_ports }}
|
{{- $_ := set $path_data "ports" $path_ports }}
|
||||||
|
|
||||||
{{- if (not (hasKey $path_data "dest")) }}
|
{{- if (not (hasKey $path_data "dest")) }}
|
||||||
{{- $_ := set $path_data "dest" $dest }}
|
{{- $_ := set $path_data "dest" $dest }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if (not (hasKey $path_data "proto")) }}
|
||||||
|
{{- $_ := set $path_data "proto" $proto }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- $_ := set $paths $path $path_data }}
|
{{- $_ := set $paths $path $path_data }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $_ := set $vhost_data "paths" $paths }}
|
{{- $_ := set $vhost_data "paths" $paths }}
|
||||||
@ -635,6 +648,8 @@ proxy_set_header Proxy "";
|
|||||||
|
|
||||||
{{- range $path, $containers := $tmp_paths }}
|
{{- range $path, $containers := $tmp_paths }}
|
||||||
{{- $dest := groupByKeys $containers "Env.VIRTUAL_DEST" | first | default "" }}
|
{{- $dest := groupByKeys $containers "Env.VIRTUAL_DEST" | first | default "" }}
|
||||||
|
{{- $proto := groupByKeys $containers "Env.VIRTUAL_PROTO" | first | default "http" | trim }}
|
||||||
|
|
||||||
{{- $path_data := get $paths $path | default (dict) }}
|
{{- $path_data := get $paths $path | default (dict) }}
|
||||||
{{- $path_ports := $path_data.ports | default (dict) }}
|
{{- $path_ports := $path_data.ports | default (dict) }}
|
||||||
{{- range $port, $containers := groupByWithDefault $containers "Env.VIRTUAL_PORT" "default" }}
|
{{- range $port, $containers := groupByWithDefault $containers "Env.VIRTUAL_PORT" "default" }}
|
||||||
@ -642,9 +657,15 @@ proxy_set_header Proxy "";
|
|||||||
{{- $_ := set $path_ports $port $path_port_containers }}
|
{{- $_ := set $path_ports $port $path_port_containers }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $_ := set $path_data "ports" $path_ports }}
|
{{- $_ := set $path_data "ports" $path_ports }}
|
||||||
|
|
||||||
{{- if (not (hasKey $path_data "dest")) }}
|
{{- if (not (hasKey $path_data "dest")) }}
|
||||||
{{- $_ := set $path_data "dest" $dest }}
|
{{- $_ := set $path_data "dest" $dest }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if (not (hasKey $path_data "proto")) }}
|
||||||
|
{{- $_ := set $path_data "proto" $proto }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- $_ := set $paths $path $path_data }}
|
{{- $_ := set $paths $path $path_data }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $_ := set $vhost_data "paths" $paths }}
|
{{- $_ := set $vhost_data "paths" $paths }}
|
||||||
@ -664,8 +685,6 @@ proxy_set_header Proxy "";
|
|||||||
{{ $vpath_containers = concat $vpath_containers $vport_containers }}
|
{{ $vpath_containers = concat $vpath_containers $vport_containers }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- /* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http". */}}
|
|
||||||
{{- $proto := groupByKeys $vpath_containers "Env.VIRTUAL_PROTO" | first | default "http" | trim }}
|
|
||||||
{{- /* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external". */}}
|
{{- /* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external". */}}
|
||||||
{{- $network_tag := groupByKeys $vpath_containers "Env.NETWORK_ACCESS" | first | default "external" }}
|
{{- $network_tag := groupByKeys $vpath_containers "Env.NETWORK_ACCESS" | first | default "external" }}
|
||||||
|
|
||||||
@ -678,7 +697,6 @@ proxy_set_header Proxy "";
|
|||||||
{{- $upstream = printf "%s-%s" $upstream $sum }}
|
{{- $upstream = printf "%s-%s" $upstream $sum }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $_ := set $vpath_data "proto" $proto }}
|
|
||||||
{{- $_ := set $vpath_data "network_tag" $network_tag }}
|
{{- $_ := set $vpath_data "network_tag" $network_tag }}
|
||||||
{{- $_ := set $vpath_data "upstream" $upstream }}
|
{{- $_ := set $vpath_data "upstream" $upstream }}
|
||||||
{{- $_ := set $vpath_data "loadbalance" $loadbalance }}
|
{{- $_ := set $vpath_data "loadbalance" $loadbalance }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user