SEPIA-Framework / sepia-docs

Documentation and Wiki for SEPIA. Please post your questions and bug-reports here in the issues section! Thank you :-)
https://sepia-framework.github.io/
236 stars 16 forks source link

Unable to connect via Android app #200

Open taiBsu opened 2 years ago

taiBsu commented 2 years ago

Describe the bug I have set up the SEPIA home docker container as a docker-compose container after doing the setup manually via the command given in the installation instruction. My docker-compose.yml looks as follows:

version: "3"
services:
  sepia:
    image: sepia/home:latest
    container_name: sepia
    restart: always
    volumes:
      - ./home:/home/admin/sepia-home-data
    ports:
      - 20726:20726
      - 20723:20723
    networks:
      - mynetwork

networks:
  mynetwork:
    external: true

Then after finishing the installation, I set up a reverse proxy to access the sepia backend via sepia.mydomain.com:

<IfModule mod_ssl.c>
<VirtualHost *:443>

  ServerName sepia.mydomain.org

  # Define reverse-proxy locations
  ProxyPass / http://sepia:20726/
  ProxyPassReverse / http://sepia:20726/

  # Upgrade WebSocket connection
  <Location /chat/>
    ProxyPass http://sepia:20723/

    RewriteEngine On
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
    RewriteRule /messages/(.*) ws://sepia:20723/messages/$1 [P]
  </Location>

  SSLCertificateFile /etc/letsencrypt/live/mydomain.org/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.org/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Now, when trying to access my server via the Android app, I keep getting "Connecting..." - "Disconnected" output on the top of the app below the S.E.P.I.A. text. It just won't connect.

SEPIA client and server versions

To Reproduce Steps to reproduce the behavior:

  1. Install the server
  2. Install the android app
  3. Login with customized hostname (my.domain.org/sepia) and login credentials
  4. error connecting

Expected behavior Well, it should connect.

Oh, by the way, thanks for the great work! :D

fquirin commented 2 years ago

Hi @taiBsu ,

I think the issue is with splitting 20726 and 20723, any specific reason for that? :thinking: Apache should be able to upgrade the Websocket connection automatically depending on either the ws:// URL or request header. I'm assuming the module 'mod_proxy_wstunnel' is installed?

If you can't get rid of the 20723 port in any way try to change the path from <Location /chat/> to <Location /sepia/chat/>.

fquirin commented 2 years ago

Some additional info to help fixing the issue:

My best guess would be something like this (untested ^^):

<VirtualHost *:443>
  ServerName sepia.mydomain.org

  Define HOST [SEPIA-IP]

  # Make sure forward-proxy is disabled
  ProxyRequests Off

  # Define reverse-proxy locations
  ProxyPass / http://${HOST}:20726/

  # WebSocket support
  RewriteEngine on
  RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
  RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
  RewriteRule .* ws://${HOST}:20726%{REQUEST_URI} [P]

</VirtualHost>