diff --git a/backend/templates/_location.conf b/backend/templates/_location.conf index 2b857933..f286fda7 100644 --- a/backend/templates/_location.conf +++ b/backend/templates/_location.conf @@ -1,11 +1,16 @@ location {{ path }} { - set $upstream {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}$request_uri; + set $targetUri {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}; + {% unless path contains "~" and path contains "(" and path contains ")" %} + if ($request_uri != /){ + set $targetUri $targetUri$request_uri; + } + {% endunless %} proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; - proxy_pass $upstream; + proxy_pass $targetUri; {% if access_list_id > 0 %} {% if access_list.items.length > 0 %} diff --git a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf index 1fda72b9..ac5b306a 100644 --- a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf +++ b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf @@ -1,9 +1,9 @@ -set $upstream $forward_scheme://$server:$port$request_uri; +set $targetUri $forward_scheme://$server:$port$request_uri; add_header X-Served-By $host; proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; -proxy_pass $upstream; +proxy_pass $targetUri;