gunnery
December 12, 2022, 3:11am
1
Working locally, things seem to work ok.
However when I load this to docker on my remote server, I keep getting this error when I try and use sockets.
Could anyone throw me some suggestions as to what is going wrong?
Firefox can’t establish a connection to the server at wss://blocked-out/socket.io/?EIO=4&transport=websocket.
Local or ISP Firewall blocking the protocol ?
gunnery
December 12, 2022, 8:30pm
3
Not too sure, what ports does it run on? Or is there something else that should be opened? Really confused by this.
1 Like
It can run on any port. Is there a sockets server running on the machine?
krish
December 12, 2022, 9:17pm
5
There could be many different reason why you cannot access it.
What is your envirement setup? Docker? are there firewall on the server? etc… need more details.
My environment is completely different. This may be a good start
krish
December 12, 2022, 9:29pm
7
Sorry, the reply was meant for @gunnery
gunnery
December 12, 2022, 10:48pm
9
OK looking into this further, when I use (in the terminal):
curl "https://domain.com/socket.io/?EIO=4&transport=polling
I get a response of:
0{“sid”:“4zWkdD4clhoWy2_7AAAD”,“upgrades”:[“websocket”],“pingInterval”:25000,“pingTimeout”:20000,“maxPayload”:1000000}
Which I assume is working, however in the browser I am getting:
can’t establish a connection to the server at wss://domain.com/socket.io/?EIO=4&transport=websocket
I am using a reverse proxy to get the the docker container through the url.
Not really sure what is causing this as it seems as sockets is working on the server
gunnery
December 12, 2022, 10:55pm
10
Docker container running on Ubuntu server.
Yes there is a firewall but all the required ports are open as far as I can see.
Is the socket.io version of the client and server the same?
gunnery
December 13, 2022, 5:57am
12
sorry to sound dumb, but how do I check that?
gunnery
December 13, 2022, 6:08am
13
so on the server I am getting socket.io @4.5.4
Have you tried with Chrome?
There was a known issue with Firefox.
it’s dependent on whether you are using a self-signed or trusted cert ?
gunnery
December 13, 2022, 7:09am
15
getting the same issue in chrome:
websocket.js:54 WebSocket connection to ‘wss://xxx.xxx/socket.io/?EIO=4&transport=websocket’ failed:
gunnery
December 13, 2022, 7:15am
17
I was but I swapped over to Apache to see if it would make any difference and it’s not
This is most likely a reverse proxy/server configuration problem. Did you have proxy_pass config in place on NGINX ?
gunnery
December 13, 2022, 7:20am
19
yep using a reverse proxy through the aapanel
Try this Apache HTTPD config
Header add Set-Cookie "SERVERID=sticky.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://nodes_polling">
BalancerMember "http://app01:3000" route=app01
BalancerMember "http://app02:3000" route=app02
BalancerMember "http://app03:3000" route=app03
ProxySet stickysession=SERVERID
</Proxy>
<Proxy "balancer://nodes_ws">
BalancerMember "ws://app01:3000" route=app01
BalancerMember "ws://app02:3000" route=app02
BalancerMember "ws://app03:3000" route=app03
ProxySet stickysession=SERVERID
</Proxy>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) balancer://nodes_ws/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) balancer://nodes_polling/$1 [P,L]
ProxyTimeout 3