DEV Community

loading...

Rocket Chat iOS WebSocket Error

Menderes Keskin
・1 min read

Hello to everyone,

I redesign the on-prem building with micro architecture. I started Rocket Chat in docker, but on iOS devices; When I log in, "Websocket has been disabled. Contact the system administrator." warning was available.

I did a little research to fix the problem. If you add the following commands to your Nginx configuration file, the problem is solved.

Happy days everyone.

upstream rocket {
   server [CONTAINER_IP:PORT];
}

server {
   listen 443 ssl;
   client_max_body_size 200M;                                        
   server_name ROCKETCHATURL;                                      
   access_log /dev/stdout;
  # I use "valian/docker-nginx-auto-ssl" image.                                         
   include resty-server-https.conf;                                  
 location / {                                                      
   proxy_pass http://rocket;                                         
   proxy_http_version 1.1;                                           
   proxy_set_header Upgrade $http_upgrade;                           
   proxy_set_header Connection $connection_upgrade;                  
   proxy_set_header Host $host;                                      
 }      
 location ~ "/sockjs/[\d]{3}/[\w]{8}/websocket" {
   proxy_pass http://rocket;
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection $connection_upgrade;
   proxy_set_header Host $http_host;
   proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-Origin ''
  }
 location /websocket {
   proxy_pass http://rocket;
   proxy_http_version 1.1;      
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection $connection_upgrade;
   proxy_read_timeout 7d;
   proxy_set_header Host $http_host;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-Origin '';
 }
}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)