Url validation and livechat failing after updating domain


I set up am Ubuntu 22 VM running RocketChat for development purposes. Initially, it did not have a DNS set up for it, so I’d just access it through its network IP: 20.xxx.xx.19:3000. All of its setup was done at this state.

On my personal machine, I :

  • Created an API service with endpoint for RocketChat webhook running on 5001
  • Ran ngrok to make 5001 available for VM

On RocketChat, I:

  • Configured RocketChat’s webhook and tested it (success)

Back to personal machine:

  • I tested livechat using the js script pointing it to 20.xxx.xx.19:3000 in a standalone HTML page
  • Icon appears and I can talk with active agents
  • Validated that the integration with the messages worked perfectly

From now on I’ll refer to https://rocketchat.domain.com as $DOMAIN$ everywhere because this forum doesn’t let me post more than 2 links. Weird rule but ok.

For several reasons, I set up a DNS alias for the VM on $DOMAIN$ and updated apache2 to proxy localhost:3000 to the new alias.

On my personal machine, I:

  • Logged in $DOMAIN$ normally and was prompted to update the config with new domain, which I accepted.
  • Updated the livechat HTML so that I’d point to $DOMAIN$
  • Opened the html again in the browser

Here is the problem: now, livechat icon doesn’t appear and all I get on the browser console logs is:

WebSocket connection to 'wss://rocketchat.domain.com/websocket' failed: Could not load content for webpack://rocket.chat/src/Connection.ts (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)

From RocketChat logs, I can see that URL validation is failing and for some reason meteor is still pointing to 20.xxx.xx.19:3000. I don’t know if this is the problem, but URL validation never failed before I updated the DNS for the VM.

Preferably, I’d like to not have to set up the workspace again from scratch to fix this, since I’ll have to stick with the new DNS alias from now on. Any ideas?

Server Setup Information

  • Version of Rocket.Chat Server: 6.10.0-develop
  • Operating System: Ubuntu 22
  • Deployment Method: Linux (rocket.chat)
  • Number of Running Instances: 1
  • DB Replicaset Oplog: ?
  • NodeJS Version: 14.21.4 - x64
  • MongoDB Version: 7.0.5
  • Proxy: apache2
  • Firewalls involved:
    inbound allow
    80 (all), 433 (all), 22 (specific sources including personal machine), 3000 (specific sources including personal machine)
    outbound allow
    80 (all), 433 (all)

Any additional Information

Livechat HTML
I’ve also replaced the actual URL with $DOMAIN$ here, but the real HTML has the full url.

<script type="text/javascript">
    const department = 'Dev';
    (function(w, d, s, u) {
        w.RocketChat = function(c) {
            w.RocketChat.livechat.onPrechatFormSubmit(() => { w.RocketChat.livechat.setDepartment(department); });
        }; w.RocketChat._ = []; w.RocketChat.url = u;
	    var h = d.getElementsByTagName(s)[0], j = d.createElement(s);
	    j.async = true; j.src = '$DOMAIN$/livechat/rocketchat-livechat.min.js?_=201903270000';
	    h.parentNode.insertBefore(j, h);
    })(window, document, 'script', '$DOMAIN$/livechat');

Server logs

@rocket.chat/meteor:dsv: => Started your app.
@rocket.chat/meteor:dsv: => App running at: http://localhost:3000/
@rocket.chat/meteor:dsv: I20240709-21:13:00.683(0)? +----------------------------------------------------------+
@rocket.chat/meteor:dsv: I20240709-21:13:00.683(0)? |                      SERVER RUNNING                      |
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? +----------------------------------------------------------+
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? |                                                          |
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? |  Rocket.Chat Version: 6.10.0-develop                     |
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? |       NodeJS Version: 14.21.4 - x64                      |
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? |      MongoDB Version: 7.0.5                              |
@rocket.chat/meteor:dsv: I20240709-21:13:00.684(0)? |       MongoDB Engine: wiredTiger                         |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |             Platform: linux                              |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |         Process Port: 26403                              |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |             Site URL: https://rocketchat.domain.com  |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |     ReplicaSet OpLog: Enabled                            |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |          Commit Hash: 4b3f06efee                         |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |        Commit Branch: develop                            |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? |                                                          |
@rocket.chat/meteor:dsv: I20240709-21:13:00.685(0)? +----------------------------------------------------------+
@rocket.chat/meteor:dsv: I20240709-21:13:00.946(0)? [2024-07-09T21:13:00.945Z] INFO  ead09c13-7a7f-42dd-978a-cc952aae8aa2/REGISTRY: '$node' service is registered.
@rocket.chat/meteor:dsv: I20240709-21:13:00.946(0)? [2024-07-09T21:13:00.945Z] INFO  ead09c13-7a7f-42dd-978a-cc952aae8aa2/REGISTRY: 'matrix' service is registered.
@rocket.chat/meteor:dsv: I20240709-21:13:00.946(0)? [2024-07-09T21:13:00.946Z] INFO  ead09c13-7a7f-42dd-978a-cc952aae8aa2/$NODE: Service '$node' started.
@rocket.chat/meteor:dsv: I20240709-21:13:00.946(0)? [2024-07-09T21:13:00.946Z] INFO  ead09c13-7a7f-42dd-978a-cc952aae8aa2/MATRIX: Service 'matrix' started.
@rocket.chat/meteor:dsv: I20240709-21:13:00.947(0)? [2024-07-09T21:13:00.946Z] INFO  ead09c13-7a7f-42dd-978a-cc952aae8aa2/BROKER: ✔ ServiceBroker with 2 service(s) started successfully in 525ms.
@rocket.chat/meteor:dsv: I20240709-21:13:01.234(0)? [2024-07-09T21:13:00.367Z] WARN (VoIPAsteriskService/27357 on vmrocketchat): Voip is not enabled. Cant start the service
@rocket.chat/meteor:dsv: I20240709-21:13:01.235(0)? [2024-07-09T21:13:00.397Z] USERLVL (Migrations/27357 on vmrocketchat): Not migrating, already at version 304
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)? [2024-07-09T21:13:00.425Z] USERLVL (DatabaseWatcher/27357 on vmrocketchat): Using change streams
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)? [2024-07-09T21:13:00.434Z] ERROR (License/27357 on vmrocketchat): Url validation failed
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)?     url: {
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)?       "value": "20.xxx.xx.19:3000",
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)?       "type": "url"
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)?     }
@rocket.chat/meteor:dsv: I20240709-21:13:01.236(0)?     workspaceUrl: "rocketchat.domain.com"
@rocket.chat/meteor:dsv: I20240709-21:13:02.261(0)? [2024-07-09T21:13:01.722Z] USERLVL (License/27357 on vmrocketchat): License installed
@rocket.chat/meteor:dsv: I20240709-21:13:02.261(0)?     version: "3.0"
@rocket.chat/meteor:dsv: I20240709-21:13:02.261(0)?     hash: "SqOtZL7g"

I think there is probably a mixup between the URL you are using and the one that was registered.

Suggest you check in your cloud account at what you have there.

You might need to remove the current entry and create a new one and register it properly.

So this is what is registered:

“value”: “20.xxx.xx.19:3000”,

This is what you have:


That will fail the registration and requires fixing.

I really suggest you don’t do ANY access via 3000 - that will confuse it. Use the correct URL the whole time with your reverse proxy and certs. That is a configuration that works.

Like I mentioned, when I logged on my cloud account I was prompted to update the domain and I accepted. I’m not accessing it through 3000 anymore and everything should be correct.

And as if to prove my point, between turning off the VM yesterday and turning it on today, that URL validation error went away from the server logs. BUT livechat still doesn’t work (the livechat HTML is the one I sent in the first post which is exactly the same one that’s available on cloud “Livechat Instalation” plus setting a department for the chat).

And just to be clear, livechat worked perfectly when there was no DNS and no cert and it was pointing to IP+port.

What do you suggest I do? I would appreciate step by step instructions.

Edit: My VM is not public, it has a very restrictive access. Is this livechat error happening because I am missing some extra firewall rule for the websocket? If yes, how should I set it up?