Websocket connection problems via ssl on special port
-
Hi nodeBB-Community,
I want to provide my forum via https. In my hosting environment I have to use a direct connetion to a private opened port (e.g. 63542) for socket io to establish stable websocket-connection. I did this in the nodebb config.json in this way:
"socket.io": { "address": "subdomain.tld.com:63542" }
Everything works fine and fast with http. When I switch to https I get for all requests to /socket.io/
net::ERR_CONNECTION_CLOSED
I still can use the forum and do a login but I always have the notification visible that the connection was lost and the forum is trying to re-establish the connection.Has anybody a idea what I can do for a consistent SSL-Connection?
Thanks,
Chris -
@julian I got feedback and a little bit of help from the support of my hoster. They told me, that I should use a separate port for the websocket communication. my actual config.json looks like this:
{ "url": "https://subdomain.tld.com", "port": "63542", "use-port": true, "secret": "xxxx", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "12345", "username": "xxx", "password": "xxx", "database": "xxx" }, "socket.io": { "address": "subdomain.tld.com:65123" } }
It still does not work, but I think the socket.io adress/path is the current problem. Is my config correct or is there something wrong and/or could you help me with the correct
address
property forsocket.io
?Thanks,
Chris -
I tried to use array for the
ports
property, but this doesn't work either.{ "url": "https://subdomain.tld.com", "port": ["63542", "65123"], "use-port": true, "secret": "xxxx", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "12345", "username": "xxx", "password": "xxx", "database": "xxx" }, "socket.io": { "address": "subdomain.tld.com:65123" } }
-
There's not enough information here.
Why are you not using a normal domain? Who is your DNS host? What type of SSL certificate and what provider? Are you using a reverse proxy? Apache or Nginx? Why did you expect clustering to fix your SSL issue?
-
Hi @yariplus ,
the forum runs on a subdomain, because there is a Wordpress-Site on the "normal" domain, which is by a different hoster, who is the DNS-Host (http://checkdomain.de), too. The nodeBB installation is hosted by http://uberspace.de and the SSL certificate is providec by letsencrypt. As a proxy I have to use Apache 2.2. This is the reason for the private Port, because Apache 2.2 can not handle websockets. Everything worked fine till i tried to switch to https. Here is the .htaccess of the Apache:
RewriteEngine On RewriteRule ^(.*)$ http://localhost:63542/$1 [NC,P,L]
When I to switch zu https, there is a http an a https (socket.io) to the same Port. That is the reason why i want to use a separate port for socket.io, if this is possible.
Hope there is enough information now, if not, please tell me what you need.
thanks for your help!
best,
chris -
@suparomana said in Websocket connection problems via ssl on special port:
Apache 2.2 can not handle websockets
Ahh, thanks. Okay, that makes sense now. It sounds like it's failing because of the special port. Since that port is sending directly to NodeBB and not through the Apache proxy, NodeBB does not know the SSL key, so it will fail the connection.
I think there used to be a way to feed the SSL Key path to NodeBB in config.json, but I don't see any docs on it anymore, and I'm not even sure if that would work.
I think your best bet is to try getting websockets to work through Apache2, there seems to be several methods even though there's no official support.
https://serverfault.com/questions/290121/configuring-apache2-to-proxy-websocket