Download:
child 308:bb6186df3db5
parent 306:6092d5a5668b
307:7f86cb18d285
Anton Shestakov <av6@dwimlabs.net>, Thu, 28 Jun 2018 22:45:21 +0800
provision: allow connections over WebSocket in addition to BOSH

3 файлов изменено, 25 вставок(+), 2 удалений(-) [+]
contrib/provision/roles/tram-im/tasks/main.yml file | annotate | diff | comparison | revisions
contrib/provision/roles/tram-im/templates/etc/nginx/sites-available/tram-im file | annotate | diff | comparison | revisions
contrib/provision/roles/tram-im/templates/etc/prosody/conf.avail/tram-im.cfg.lua file | annotate | diff | comparison | revisions
--- 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
@@ -50,14 +50,14 @@
notify:
- restart prosody
-- name: Add BOSH proxy Nginx site
+- name: Add BOSH/WebSocket proxy Nginx site
template:
src: etc/nginx/sites-available/tram-im
dest: /etc/nginx/sites-available/{{ domain }}
notify:
- restart nginx
-- name: Enable BOSH proxy Nginx site
+- name: Enable BOSH/WebSocket proxy Nginx site
file:
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
@@ -2,6 +2,11 @@
text/coffeescript coffee;
}
+map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+}
+
server {
server_name {{ domain }};
@@ -67,4 +72,19 @@
proxy_buffering off;
tcp_nodelay on;
}
+
+ 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;
+ proxy_buffering off;
+ tcp_nodelay on;
+ }
}
--- 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
@@ -4,6 +4,8 @@
https_interfaces = { }
consider_bosh_secure = true
+consider_websocket_secure = true
+cross_domain_websocket = "https://{{ domain }}"
VirtualHost "{{ domain }}"
@@ -11,6 +13,7 @@
modules_enabled = {
"bosh",
+ "websocket",
"register",
"vcard",
"private",