From fb63edf7848000eb34d125818d09a977f2299de5 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <tschneider@asta.rwth-aachen.de>
Date: Wed, 3 Feb 2021 22:47:39 +0100
Subject: [PATCH] webserver: Allow configuring proxy_pass scheme and
 proxy_set_header Host

---
 webserver/templates/locations/proxy.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/webserver/templates/locations/proxy.conf b/webserver/templates/locations/proxy.conf
index ee3566d..37f9de8 100644
--- a/webserver/templates/locations/proxy.conf
+++ b/webserver/templates/locations/proxy.conf
@@ -10,7 +10,7 @@
         proxy_set_header X-Remote-Groups $sso_groups;
         {% endif %}
         {% if location.proxy_host is defined %}
-        proxy_pass https://{{location.proxy_host}}{% if not location.proxy_relative|default(false) %}/{% endif %};
+        proxy_pass {{location.proxy_scheme|default("https")}}://{{location.proxy_host}}{% if not location.proxy_relative|default(false) %}/{% endif %};
         {% elif location.proxy_port is defined %}
         proxy_pass http://127.0.0.1:{{location.proxy_port}}{% if not location.proxy_relative|default(false) %}/{% endif %};
         {% elif server.port is defined %}
@@ -20,7 +20,7 @@
         {% else %}
         proxy_pass http://unix:{{server.socket|default('/run/nginx/' ~ server.server_name ~ '.sock')}}{% if not location.proxy_relative|default(false) %}:/{% endif %};
         {% endif %}
-        proxy_set_header Host {{server.server_name}};
+        proxy_set_header Host {{location.proxy_set_host|default(server.server_name)}};
         {% if server.forward_http|default(true) %}
         proxy_set_header X-Forwarded-Proto https;
         {% else %}
-- 
GitLab