From 466a17f3529bff77f6c4c39c30681f009fc7acb2 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 30 Nov 2018 20:30:26 +0100 Subject: [PATCH] library/roles/nginx/templates/nginx-virthost.j2: Fix the websockets configuration. --- nginx/templates/nginx-virthost.j2 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nginx/templates/nginx-virthost.j2 b/nginx/templates/nginx-virthost.j2 index 27878444..812cf2db 100644 --- a/nginx/templates/nginx-virthost.j2 +++ b/nginx/templates/nginx-virthost.j2 @@ -93,6 +93,11 @@ server { {% if nginx_websockets_support is defined and nginx_websockets_support %} proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; + {% else %} + {% if item.websockets is defined and item.websockets %} + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + {% endif %} {% endif %} {% if item.proxy_standard_setup is defined and item.proxy_standard_setup %} @@ -126,6 +131,11 @@ server { proxy_pass {{ location.target }}; {% endif %} + {% if location.websockets is defined and location.websockets %} + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + {% endif %} + {% if location.extra_conf is defined %} {{ location.extra_conf }} {% endif %} @@ -219,6 +229,16 @@ server { {% endif %} {% endif %} + {% if nginx_websockets_support is defined and nginx_websockets_support %} + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + {% else %} + {% if item.websockets is defined and item.websockets %} + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + {% endif %} + {% endif %} + {% if item.additional_options is defined %} {% for add_opt in item.additional_options %} {{ add_opt }};