jech / galene

The Galène videoconference server
https://galene.org
MIT License
899 stars 119 forks source link

Browser refuse to connect to WebSocket when using insecure Galene behind a reverse proxy #160

Closed erdnaxe closed 12 months ago

erdnaxe commented 1 year ago

When running Galène in -insecure mode, groupStatus.endpoint will start with ws://.

This is problematic when using a HTTPS reverse proxy pointing to a insecure (HTTP) Galene as the browser will refuse to connect to ws:// from a https:// website.

A dirty fix could be:

--- a/static/galene.js
+++ b/static/galene.js
@@ -3492,7 +3492,10 @@ async function serverConnect() {
     let url = groupStatus.endpoint;
     if(!url) {
         console.warn("no endpoint in status");
-        url = `ws${location.protocol === 'https:' ? 's' : ''}://${location.host}/ws`;
+        url = `ws://${location.host}/ws`;
+    }
+    if (location.protocol === 'https:') {
+        url = url.replace("ws://", "wss://");
     }

     try {
jech commented 1 year ago

This should be handled automatically if you set proxyURL in the config file. Can you confirm that proxyURL is set to an HTTPS address? Please see the code at https://github.com/jech/galene/blob/master/group/group.go#L1256

jech commented 12 months ago

Please reopen if setting proxyURL doesn't fix the issue.