Websockets work except keepalive

Apache driving me nuts…

I have a websocket for colibri, and it seems I have one for xmpp, but I am getting errors for the keepalive check.

jitsi-meet 2.0.5390-3
jitsi-meet-prosody 1.0.4628-1
jitsi-meet-tokens 1.0.4628-1
jitsi-meet-web 1.0.4628-1
jitsi-meet-web-config 1.0.4628-1
jitsi-videobridge2 2.1-416-g2f43d1b4-1
prosody-trunk 1nightly1322-1~stretch

We can see colibri seems to be OK from the logs:

2021-01-28 15:14:56.128 INFO: [1] MainKt.main#119: Starting public http server
2021-01-28 15:14:56.266 INFO: [1] ColibriWebSocketService.#40: Base URL: wss://jitsi.mydomain.com:443/colibri-ws/jvbimpamark
2021-01-28 15:14:56.298 INFO: [1] org.eclipse.jetty.util.log.Log.initialized: Logging initialized @1952ms to org.eclipse.jetty.util.log.JavaUtilLog
2021-01-28 15:14:56.552 INFO: [1] ColibriWebSocketService.registerServlet#65: Registering servlet at /colibri-ws/, baseUrl = wss://jitsi.mydomain.com:443/colibri-ws/jvbmydomain*

Here’s the websocket in Chromium:

Request URL: wss://jitsi.mydomain.com/colibri-ws/jvbimpamark/4c7bfd0f48b67884/25b272a5?pwd=342td27r2tkvrgd2jp6998gdbk
Request Method: GET
Status Code: 101 Switching Protocols

Here’s the websocket for the main connection:

Request URL: wss://jitsi.mydomain.com/xmpp-websocket?room=private
Request Method: GET
Status Code: 101 Switching Protocols

That is fine and we can connect.

But here is the websocket for the connection KeepAlive test.

It seems that XmppConnection modifies the wss to https here and that fails:

XmppConnection.js:383

    this._wsKeepAlive = setTimeout(() => {
        const url = this.service.replace('wss://', 'https://').replace('ws://', 'http://');

        fetch(url).catch(
            error => {
                logger.error(`Websocket Keep alive failed for url: ${url}`, { error });
            })

This is the connection it attempts to make - https and not wss - and that gives a 500 error:

“GET /xmpp-websocket?room=private HTTP/1.1” 500 990 “https://jitsi.mydomain.com/private

Request URL: https://jitsi.mydomain.com/xmpp-websocket?room=private
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 1.2.3.4:443
Referrer Policy: no-referrer-when-downgrade

Here are the sections in Apache:

# Seems to work
  <Location "/http-bind">
    RequestHeader set Host "jitsi.mydomain.com"
    ProxyPass http://localhost:5280/http-bind
    ProxyPassReverse http://localhost:5280/http-bind
  </Location>

# Seems to work
  <Location /colibri-ws/jvbmydomain>
    RequestHeader set Host "jitsi.mydomain.com"
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
    RewriteRule /colibri-ws/jvbimpamark/(.*) ws://localhost:9090/colibri-ws/jvbmydomain/$1 [P]
  </Location>

# This is picking up wss but not https?
  <Location "/xmpp-websocket">
    RequestHeader set Host "jitsi.mydomain.com"
    RewriteCond ${HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond ${HTTP:CONNECTION} Upgrade$ [NC]
    ProxyPass "ws://localhost:5280/xmpp-websocket"
  </Location>

Any suggestions appreciated - the apache config has been cobbled together from various attemps around the interwebs - it is not the easiest thing to find consistent info on.

I know it is probably something very simple but having read til my eyes bled and tried everything I can think of I have had no joy.

Thanks.

Yes, there is a small typo up there, but that wasn’t in the original settings which were correct.

After pulling my hair out for several days on & off with 2 million combinations, in the end I gave up and installed Nginx.

I don’t really understand why it is so tricky with Apache.

In the end I gave up and installed Nginx.

Worked out of the box.

Only thing that doesn’t right now seems to be tokens but that is a different story.