Mobile Apps cannot connect

I have been searching for a while and found some posts that had a similar problem, but nothing helped to fix my problem.

My server is running on https://chat.thisfro.ch (Let’s Encrypt, Apache reverse proxy). Desktop apps and server work perfectly. Android app can load messages, but not send. There’s a “Connecting in …” countdown, which keeps getting higher. iOS won’t connect at all.

Am I missing some configuration?

Thx for any advice!

Edit: Android v2.4.0, iOS v3.0.1, Server v0.66.2

This message appears because your server do not support WebSockets, take a look:

curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: chat.thisfro.ch" -H "Origin: chat.thisfro.ch" -H "Sec-WebSocket-Key: fVXESE8fjBMx8HheW0YlZQ==" -H "Sec-WebSocket-Version: 13" https://chat.thisfro.ch/websocket

HTTP/1.1 500 Internal Server Error
Date: Fri, 20 Jul 2018 14:22:27 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 612
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at 
 jannis@thisfro.ch to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at chat.thisfro.ch Port 443</address>
</body></html>

Ok thanks, didn’t realize that. Where would I get started to enable this?

Since you’re using Apache, you can start here: https://rocket.chat/docs/installation/manual-installation/configuring-ssl-reverse-proxy/#running-behind-an-apache-ssl-reverse-proxy

1 Like

I had already set it up with this guide, but doing it again resolved the issue (somehow).

Thank you very much!

Awesome, glad it worked! :heart:

1 Like

Sorry to bump this thread, but this may be in the interest of anyone else searching Google.

I am having the same as OP however I installed my server via the Ubuntu snap using these instructions. Since this seems to be the most suggested/easiest way to install the app. I was also sure to configure SSL and Caddy.

I have this error in my console:

WebSocket connection to 'wss://xanadu.chat/sockjs/645/locu3plz/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

Disabling Cloudflare will change the error to:

WebSocket connection to 'wss://xanadu.chat/sockjs/521/ettojedv/websocket' failed: Error in connection establishment: net::ERR_CERT_COMMON_NAME_INVALID

So, the Ubuntu snap instructions by default leave me with a server that cannot use mobile apps and some other external services. It also produced this nginx server config:

 listen 443 ssl;
 server_name xanadu.chat;
 ssl_certificate /etc/letsencrypt/live/xanadu.chat/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/xanadu.chat/privkey.pem;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 root /usr/share/nginx/html;
 index index.html index.htm;
# Make site accessible from http://localhost/
 server_name localhost;
 location / {
 proxy_pass http://localhost:3000/;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection “upgrade”;
 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forward-Proto http;
 proxy_set_header X-Nginx-Proxy true;
 proxy_redirect off;
}
}
server {
 listen 80;
 server_name xanadu.chat;
 return 301 https://$host$request_uri;
 }

This is a reverse proxy, yeah? Perhaps this is caused by the CERT error above, or maybe some extra config is missing?