skip to Main Content

I recently set up a rocket.chat instance on my Server via docker. Everything is working fine in browser and mac app, but not on android or ios mobile app.

After I type in the workplace url I am getting the message "Websocket is disabled on this server".

The server:

  • Ubuntu 22.04 LTS
  • Powered by Plesk 18.0.50
  • NodeJS 18

I strictly followed all configurations and hints on different posts, but nothing did the trick. My nginx config:

location ~ ^/.* {
    proxy_pass https://chat.my-domain.de:3000;
    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-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Nginx-Proxy true;
    proxy_redirect off;
}

I have no more ideas how to solve it, do you have any tips? Thanks a lot!

2

Answers


  1. Had the same issue, just instead of NginX I use the NPM (Nginx proxy manager).

    Turns out, when creating the host in NPM, I need to activate the Websocket support.
    Enable websocket support

    According to the nginx blog

    The WebSocket protocol is different from the HTTP protocol, but the WebSocket handshake is compatible with HTTP, using the HTTP Upgrade facility to upgrade the connection from HTTP to WebSocket. This allows WebSocket applications to more easily fit into existing infrastructures.

    There is also an example given with a full config.
    Maybe that will give you a bit more insight, as the $connection_upgrade is set in your config.

    But is the mapping section also integrated in the config?

    Here is the example:

    http {
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    
    upstream websocket {
        server 192.168.100.10:8010;
    }
    
    server {
        listen 8020;
        location / {
            proxy_pass http://websocket;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header Host $host;
            }
        }
    }
    
    Login or Signup to reply.
  2. For rocket.chat to mobile app work:

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    
    upstream myrocketchat {
      server 127.0.0.1:3000;
    }
    
    server {
        listen 80;
            server_name yourdomain.com;
        location / {
            proxy_pass http://myrocketchat;
            proxy_set_header Host $host;
                    proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
    
            }
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search