1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 09:48:14 +00:00

fix: do not discard containers without VIRTUAL_PATH

For containers grouped by identical VIRTUAL_HOST,
those with no VIRTUAL_PATH variable were silently discarded
when at least one container with VIRTUAL_PATH existed.
This commit is contained in:
Nicolas Duchon 2024-05-05 16:31:03 +02:00
parent 8b91f09a9b
commit be7c4c8c85
No known key found for this signature in database
GPG Key ID: EA3151C66A4D79E7

View File

@ -526,10 +526,7 @@ proxy_set_header Proxy "";
{{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }} {{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }}
{{- $paths := coalesce $vhost_data.paths (dict) }} {{- $paths := coalesce $vhost_data.paths (dict) }}
{{- $tmp_paths := groupBy $containers "Env.VIRTUAL_PATH" }} {{- $tmp_paths := groupByWithDefault $containers "Env.VIRTUAL_PATH" "/" }}
{{- if not (gt (len $tmp_paths) 0) }}
{{- $tmp_paths = dict "/" $containers }}
{{- end }}
{{- range $path, $containers := $tmp_paths }} {{- range $path, $containers := $tmp_paths }}
{{- $dest := or (first (groupByKeys $containers "Env.VIRTUAL_DEST")) "" }} {{- $dest := or (first (groupByKeys $containers "Env.VIRTUAL_DEST")) "" }}