From 20b833575931e9dc0fc757a57da87a56c835d45c Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Tue, 11 Aug 2020 15:37:26 +0200
Subject: [PATCH] Optionally allow HTTP Upgrade in proxy locations

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

diff --git a/webserver/templates/locations/proxy.conf b/webserver/templates/locations/proxy.conf
index 53dce20..ee3566d 100644
--- a/webserver/templates/locations/proxy.conf
+++ b/webserver/templates/locations/proxy.conf
@@ -37,7 +37,13 @@
         {% endif %}
         {# 1.1 and empty Connection to enable keepalive #}
         proxy_http_version "{{location.proxy_http_version|default('1.1')}}";
+        {% if location.allow_upgrade|default(false) %}
+        {# Upgrade allows usage of websockets #}
+        proxy_set_header Upgrade "$http_upgrade";
+        proxy_set_header Connection "$connection_upgrade";
+        {% else %}
         proxy_set_header Connection "";
+        {% endif %}
         {% if location.proxy_headers is defined %}
 
         {% for key, value in location.proxy_headers.items() %}
-- 
GitLab