--- a/contrib/provision/roles/tram-im/tasks/main.yml Thu Jun 28 22:44:14 2018 +0800
+++ b/contrib/provision/roles/tram-im/tasks/main.yml Thu Jun 28 22:45:21 2018 +0800
-- name: Add BOSH proxy Nginx site
+- name: Add BOSH/WebSocket proxy Nginx site
src: etc/nginx/sites-available/tram-im
dest: /etc/nginx/sites-available/{{ domain }}
-- name: Enable BOSH proxy Nginx site
+- name: Enable BOSH/WebSocket proxy Nginx site
src: /etc/nginx/sites-available/{{ domain }}
dest: /etc/nginx/sites-enabled/50{{ domain }}
--- a/contrib/provision/roles/tram-im/templates/etc/nginx/sites-available/tram-im Thu Jun 28 22:44:14 2018 +0800
+++ b/contrib/provision/roles/tram-im/templates/etc/nginx/sites-available/tram-im Thu Jun 28 22:45:21 2018 +0800
text/coffeescript coffee;
+map $http_upgrade $connection_upgrade {
server_name {{ domain }};
+ location /xmpp-websocket {
+ proxy_pass http://127.0.0.1:5280/xmpp-websocket;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_set_header Host $host;
+ proxy_set_header X-Scheme $scheme;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Real-Ip $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_read_timeout 86400;
--- a/contrib/provision/roles/tram-im/templates/etc/prosody/conf.avail/tram-im.cfg.lua Thu Jun 28 22:44:14 2018 +0800
+++ b/contrib/provision/roles/tram-im/templates/etc/prosody/conf.avail/tram-im.cfg.lua Thu Jun 28 22:45:21 2018 +0800
consider_bosh_secure = true
+consider_websocket_secure = true
+cross_domain_websocket = "https://{{ domain }}"
VirtualHost "{{ domain }}"