Skip to content

Commit 8db44bf

Browse files
carlbagdzien
authored andcommitted
Websocket support enabled for reverse proxy locations. (#97)
* Websocket support for reverse proxy locations.
1 parent 3a66e10 commit 8db44bf

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ nginx_http_template:
350350
backend:
351351
location: /
352352
proxy_pass: http://backend
353+
websocket: false
353354
health_check_plus: false
354355
upstreams:
355356
upstream1:

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ nginx_http_template:
181181
backend:
182182
location: /
183183
proxy_pass: http://backend
184+
websocket: false
184185
health_check_plus: false
185186
upstreams:
186187
upstream1:

templates/http/default.conf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ server {
4141
proxy_set_header X-Real-IP $remote_addr;
4242
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
4343
proxy_set_header X-Forwarded-Proto $scheme;
44+
{% if item.value.reverse_proxy.locations[location].websocket is defined and item.value.reverse_proxy.locations[location].websocket %}
45+
proxy_set_header Upgrade $http_upgrade;
46+
proxy_set_header Connection "Upgrade";
47+
{% endif %}
4448
}
4549

4650
{% endfor %}

0 commit comments

Comments
 (0)