Closed NeemitShastri closed 6 years ago
use Apache2 or Nginx proxy. Best practice: Apache2/Nginx is the front-end, xabber-websocket is the back-end
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; }
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.
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"; }
just reinstalled nginx and reconfigured it and proxypass is working.
Thanks for help :)
how do i configure xabber-websocket to run on wss://