redsolution / xabber-websocket

Standalone WebSocket connection manager needed to connect Xabber for Web to multiple different XMPP servers
https://www.xabber.com
GNU Affero General Public License v3.0
11 stars 7 forks source link

set up wss:// in xabber-websocket #1

Closed NeemitShastri closed 6 years ago

NeemitShastri commented 6 years ago

how do i configure xabber-websocket to run on wss://

oxoWrk commented 6 years ago

use Apache2 or Nginx proxy. Best practice: Apache2/Nginx is the front-end, xabber-websocket is the back-end

NeemitShastri commented 6 years ago

I have set up nginx for frontend, but there is problem with proxypass with error :- failed: Error during WebSocket handshake: Unexpected response code: 404

config file of nginx:-

upstream websocket_server { server 127.0.0.1:8080; }

location /websocket { proxy_pass http://websocket_server/websocket; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header` Connection "upgrade"; try_files $uri $uri/ =404; }

NeemitShastri commented 6 years ago

it gives following error :- nginx: [emerg] invalid host in upstream "ws://127.0.0.1:8080" in /etc/nginx/sites-enabled/default:20

i think ws is not allowed in upstream config as per documentation of nginx.

oxoWrk commented 6 years ago

This config has worked for me

location /websocket { proxy_pass http://127.0.0.1:8080/websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }

NeemitShastri commented 6 years ago

just reinstalled nginx and reconfigured it and proxypass is working.

Thanks for help :)