revoltchat / revite

Revolt client built with Preact.
https://app.revolt.chat
GNU Affero General Public License v3.0
874 stars 207 forks source link

bug: App is trying to access API via insecure HTTP despite config having HTTPS endpoint (selfhosted) #989

Open Kexogg opened 1 month ago

Kexogg commented 1 month ago

What happened?

I am trying to selfhost this app. In config and .env file i defined API endpoint as HTTPS, but app is trying to access it via HTTP. Because page is loaded via HTTPS, request fails. Image My config:

app = "https://revolt.mydomain"
api = "https://revolt.mydomain/api"
events = "wss://revolt.mydomain/ws"
autumn = "https://revolt.mydomain/autumn"
january = "https://revolt.mydomain/january"

My .env file:

# Hostname used for Caddy
# This should in most cases match REVOLT_APP_URL
HOSTNAME=revolt.mydomain

# URL to where the Revolt app is publicly accessible
REVOLT_APP_URL=https://revolt.mydomain

# URL to where the API is publicly accessible
REVOLT_PUBLIC_URL=https://revolt.mydomain/api
VITE_API_URL=https://revolt.mydomain/api

# URL to where the WebSocket server is publicly accessible
REVOLT_EXTERNAL_WS_URL=wss://revolt.mydomain/ws

# URL to where Autumn is publicly available
AUTUMN_PUBLIC_URL=https://revolt.mydomain/autumn

# URL to where January is publicly available
JANUARY_PUBLIC_URL=https://revolt.mydomain/january

Branch

Production (app.revolt.chat)

Commit hash

image hash: sha256:a85749fdb93e9c7170f38a7fad158b3066648db9d1890bc81f38ccb2856192c7

What browsers are you seeing the problem on?

Firefox, Chrome

Relevant log output

Uncaught (in promise) Error: Network Error createError$1 createError.js:16 onerror xhr.js:117 xhr xhr.js:114 xhr xhr.js:15 dispatchRequest$1 dispatchRequest.js:58 request Axios.js:108 2 bind.js:9 req index.js:113 get index.js:122 connect Client.js:99 awaiter Client.js:7 awaiter Client.js:3 connect Client.js:98 fetchConfiguration Client.js:108 awaiter Client.js:7 awaiter Client.js:3 fetchConfiguration Client.js:106 _class$g ClientController.tsx:47

ClientController.tsx:306 ### Desktop - [ ] Yes, this bug is specific to Revolt Desktop and is *not* an issue with Revolt Desktop itself. ### PWA - [ ] Yes, this bug is specific to the PWA.
GaMeRaM commented 1 month ago

Seems like this was fixed, but the latest docker image is outdated. After you set up your selfhosted services you can do these steps:

  1. Clone frontend repo with submodules

    git clone --recursive https://github.com/revoltchat/revite
  2. Add build params instead of image to your web service in compose.yml Before:

    # Web App (revite)
    web:
    image: ghcr.io/revoltchat/client:master
    env_file: .env
    depends_on:
      - caddy
    restart: always

After:

  # Web App (revite)
  web:
    build:
      context: ./revite
    env_file: .env
    depends_on:
      - caddy
    restart: always
  1. Then build your new web image (It takes some time. About 6.5 minutes on i7-8700)

    sudo docker compose build web
  2. And deploy it instead of registry one

    sudo docker compose up -d web
GaMeRaM commented 1 month ago

But it seems like it is not enough. When i try to join a voice call i get Status Code: 400 Bad Request Response: {"type":"VosoUnavailable","location":"crates/delta/src/routes/channels/voice_join.rs:29:20"}

After adding a random token (which i admit is stupid, but i had to try) i get a little further Status Code: 400 Bad Request Response: {"type":"VosoUnavailable","location":"crates/delta/src/routes/channels/voice_join.rs:57:30"}

Which corresponds to this code which means it cannot connect to voso aka vortex (which is expected since we did not create the vortex container)

UPD: https://github.com/revoltchat/self-hosted/issues/25#issuecomment-1114198831

Kexogg commented 1 month ago

Thanks. I forked this repo and published updated docker image to github container registry