I hosted without problems Rocket.Chat on my main server.
It's address is this: chat.alexdev.it:3000.
I hosted, on my second machine, a reverse-proxy (https://irc.alexdev.it), that works really fine. This is the config:
<VirtualHost *:80>
ServerName irc.alexdev.it
ProxyPass / http://37.228.134.44:3000/
ProxyPassReverse / http://37.228.134.44:3000/
ProxyPreserveHost On
</VirtualHost>
<VirtualHost *:443>
ServerName irc.alexdev.it
ProxyPass / http://37.228.134.44:3000/
ProxyPassReverse / http://37.228.134.44:3000/
ProxyPreserveHost On
ProxyRequests Off
</VirtualHost>
The problems occures when I try to load my LiveChat into a page. I'm using this script:
<script type="text/javascript">
(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://irc.alexdev.it/packages/rocketchat_livechat/assets/rocketchat-livechat.min.js?_=201702160944';
h.parentNode.insertBefore(j, h);
})(window, document, 'script', 'https://irc.alexdev.it/livechat');
</script>
If i try loading it on http://, no problem.
But of course, accessing the page in https, it says that it's not secure.
If I load it with https, I see this error.
_Error during WebSocket handshake: Unexpected response code: 400_
PS: I use CloudFlare
EDIT: STRANGE DETAIL
If I open the website on mobile, even with https://, no problem.
Problem occures on Desktop (Chrome)
(on mobile I use chrome)
Just to add additional info:
The chat loads OK, no errors reported, but when you try to open the options menu.

If you try to switch departments, error 400.
writing in chat opens a livechat session, but no agent is notified or assigned and it does not appear as a opened session.
No errors reported on the nginx proxy or by the server log.
The wss connection _seems_ fine.
Forgot: Current version 0.69.1
Got fresh info, straight from the latest development 0.70 as of the time of writing.
Exception while invoking method 'livechat:setDepartmentForVisitor' Error: Match error: Expected string, got null
at check (/var/www/rocket.chat/bundle/programs/server/packages/check.js:68:17)
at MethodInvocation.livechat:setDepartmentForVisitor (/var/www/rocket.chat/bundle/programs/server/packages/rocketchat_livechat.js:2082:5)
at MethodInvocation.methodsMap.(anonymous function) (/var/www/rocket.chat/bundle/programs/server/packages/rocketchat_lib.js:2496:36)
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at maybeAuditArgumentChecks (/var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:1877:12)
at DDP._CurrentMethodInvocation.withValue (/var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:902:126)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12)
at DDPServer._CurrentWriteFence.withValue (/var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:902:98)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12)
at Promise (/var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:902:46)
at new Promise (
at Session.method (/var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:875:23)
at /var/www/rocket.chat/bundle/programs/server/packages/ddp-server.js:754:85
Sanitized and reported to the client as: Match failed [400]
undefined undefined
Hope it helps.
I face the same issue, and chrome and safari both have the same issue, I don't know how to deal with it. It works well the day before yesterday, and then suddenly not work today.
I'm fixed the issue by adding lines to nginx config:
server {
...
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
...
}
I am experiencing this (no nginx) any ideas?
@rocket-cat close
The original issue was most likely configuration.
A lot has changed in Rocket since this was originally raised.
Please read here for getting some help.
Most helpful comment
I'm fixed the issue by adding lines to nginx config: