Error conection socket.io

Hi everyone,

I was trying to connect the chat on my own website, however, sometimes it stops responding to me and I have this error:

WebSocket connection to ‘wss: //mosaico.arus.com.co: 3000 / socket.io /? EIO = 3 & transport = websocket & sid = 009d64e76f2d4945824d77731e671aa5’ failed: Error during WebSocket handshake: Unexpected response code: 200

Hi @stephaniarm26!

Are you using some kind of reverse proxy?

hi @saurabh-m523!

I’m using a load balancer Nginx!

Hmm…

I faced similar kind of problem once. I was using Nginx as reverse proxy.

It turns out that simply forwarding the HTTP requests to the rasa server is not enough in case of the socketio channel. After the initial handshake, the channel tries to upgrade the connection to make it a WebSocket (WSS). Nginx can’t do this unless explicitly specified.

So, in the nginx config use something similar to this:

location / {
		proxy_pass http://localhost:5001/;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;                                                      
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
	}

As you can see in the config above, I’m telling Nginx to upgrade the connection.

Please try it out. Hope it helps :slightly_smiling_face: