From c203d1a0d810e527eed9f68f84b349b7fc4ccb5b Mon Sep 17 00:00:00 2001 From: Julian Reinhardt Date: Sat, 6 Nov 2021 13:38:02 +0100 Subject: [PATCH] Requires ~() in location to remove $request_uri and removes $request_uri if it is just a slash --- backend/templates/_location.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/templates/_location.conf b/backend/templates/_location.conf index 7c84471e..f286fda7 100644 --- a/backend/templates/_location.conf +++ b/backend/templates/_location.conf @@ -1,5 +1,10 @@ location {{ path }} { - set $targetUri {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}{% unless path contains "(" %}$request_uri{% endunless %}; + 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;