Websocket some users can connect

September 26, 2016 619 views
Nginx Ubuntu

Some users are able to connect the web-sockets while others can't.
My code.

GNU nano 2.2.6 File: /etc/nginx/sites-enabled/default

server {

 listen 80;
listen 443 default_server ssl;
root /usr/share/nginx/html;
index index.html index.htm;

server_name budokai-online.com;

ssl off;
ssl_certificate      /etc/ssl/budokai-online_com.crt;
ssl_certificate_key  /etc/ssl/budokai-online_com.key;

if ($ssl_protocol = "") {
rewrite ^ https://$host$request_uri? permanent;

location / {
# Backend Sinatra-Websockets
proxyhttpversion 1.1;
proxypass http://budokai-online.com:8080;
setheader X-Real-IP $remoteaddr;
proxysetheader Host $host;
proxysetheader X-Forwarded-For $proxyaddxforwardedfor;
proxysetheader XFORWARDEDPROTO https;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
    proxy_read_timeout 86400;
    # add_header    Sec-WebSocket-Protocol  'v10.stomp, v11.stomp';
1 comment
  • A couple things to check/share to help debug this issue:

    1.) What error message are the users seeing? The developer console in most modern browsers should provide some additional details for the connection attempt.

    2.) What is recorded in your nginx log files?

    3.) Have you implemented any logging in your websocket server daemon?

Be the first one to answer this question.