From 87731a8b5c7ee698c71bbe92aea50494b127daf7 Mon Sep 17 00:00:00 2001 From: Julian Reinhardt Date: Mon, 25 Oct 2021 14:27:37 +0200 Subject: [PATCH 1/3] Revert "Utilise variable for custom locations proxy_pass" This reverts commit 6c1ae77a2a40283c5444c2f7e0a7c8227aeecbd2. --- backend/templates/_location.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/templates/_location.conf b/backend/templates/_location.conf index 7d707009..5a7a6abe 100644 --- a/backend/templates/_location.conf +++ b/backend/templates/_location.conf @@ -1,11 +1,10 @@ location {{ path }} { - set $upstream {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}; 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 {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}; {% if access_list_id > 0 %} {% if access_list.items.length > 0 %} From bbde7a108aa1ef7353a8c314fdddd5e127fc81a4 Mon Sep 17 00:00:00 2001 From: Julian Reinhardt Date: Mon, 25 Oct 2021 14:48:22 +0200 Subject: [PATCH 2/3] Use variable with full uri in proxy pass --- backend/templates/_location.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/templates/_location.conf b/backend/templates/_location.conf index 5a7a6abe..2b857933 100644 --- a/backend/templates/_location.conf +++ b/backend/templates/_location.conf @@ -1,10 +1,11 @@ location {{ path }} { + set $upstream {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}$request_uri; 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 {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }}; + proxy_pass $upstream; {% if access_list_id > 0 %} {% if access_list.items.length > 0 %} From ca59e585d81d953b79c117eeb3c61743ad4ac85d Mon Sep 17 00:00:00 2001 From: Julian Reinhardt Date: Mon, 25 Oct 2021 14:58:02 +0200 Subject: [PATCH 3/3] Uses variable in proxy_pass for normal proxy hosts --- docker/rootfs/etc/nginx/conf.d/include/proxy.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf index c0dce061..1fda72b9 100644 --- a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf +++ b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf @@ -1,8 +1,9 @@ +set $upstream $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 $forward_scheme://$server:$port; +proxy_pass $upstream;