Livechat widget loads but tries to connect to localhost:3000

Recently upgraded to v7 and livechat widget not working

The widget loads but somewhere along the way after it loads all the chunks it tries to connect with localhost:3000:

It appears this is the js chunk responsible for the wrong connection with localhost: 92839.chunk.bf9fa.js

http://localhost:3000/api/v1/livechat/config?token=5ed70de03b98b461651ccd2d3e661a931ef6ff2de270b5788755edd9dc60842c

I have reviewed the suggestion here: https://docs.rocket.chat/docs/livechat-widget-installation

The reverse proxy config does seem to point to the same url as the widget install script so not sure if that could be at play.

Here is my apache config file:

ServerName chat.example.com
ErrorLog /var/log/apache2/chat-error.log
CustomLog /var/log/apache2/chat-access.log combined
<Location />
    Require all granted
</Location>
RewriteEngine On
RewriteCond %{HTTP:CONNECTION} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*)           ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*)           http://localhost:3000/$1 [P,L]
ProxyPassReverse /          http://localhost:3000/
SSLCertificateFile /etc/letsencrypt/live/chat.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/chat.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

And here is my livechat widget script:

(function(w, d, s, u) {
    w.RocketChat = function(c) { w.RocketChat._.push(c) }; w.RocketChat._ = []; w.RocketChat.url = u;
    var h = d.getElementsByTagName(s)[0], j = d.createElement(s);
    j.async = true; j.src = 'https://chat.example.com/livechat/rocketchat-livechat.min.js?_=202503120000';
    h.parentNode.insertBefore(j, h);
})(window, document, 'script', 'https://chat.example.com/livechat')

This was all working perfectly before the update.