From 3a52a1156fa6580d015af7e689ab8f3afafceb8d Mon Sep 17 00:00:00 2001
From: nd <git@notandy.de>
Date: Fri, 24 Dec 2021 18:42:48 +0100
Subject: [PATCH] add support to overwrite host header if only a location has a
 backend

---
 README.md               | 3 +++
 templates/vhost.conf.j2 | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 4fa9738..5f2e89b 100644
--- a/README.md
+++ b/README.md
@@ -126,6 +126,9 @@ path :''
 
 # can be 'all' or 'any'
 satisfy: 'all
+
+# example: "https://upstream". If set to None no reverse proxy will be set up.
+backend: None
 ```
 
 **mapsconfig**:
diff --git a/templates/vhost.conf.j2 b/templates/vhost.conf.j2
index 3d8fbb4..bbffbec 100644
--- a/templates/vhost.conf.j2
+++ b/templates/vhost.conf.j2
@@ -50,7 +50,7 @@ server {
 		proxy_buffering off;
 
 		# add proxy headers
-		proxy_set_header Host			{{ vhost.host }};
+		proxy_set_header Host			{{ location.host|d(vhost.host) }};
 		proxy_set_header X-Real-IP		$remote_addr;
 		proxy_set_header X-Forwarded-For	$proxy_add_x_forwarded_for;
 		proxy_set_header X-Forwarded-Proto	$scheme;
-- 
GitLab