Reroute socket.io | Cloudflare
-
Is there a way to reroute only the socket.io (WebSockets) requests to a subdomain?
Cloudflare is allowing WebSockets only on Business / Enterprise Plans."socket.io": { "transports": ["websocket", "polling"], "address": "live.domain.tld" }
Tried this NodeBB Conf. - but didn't work. Prevented me from starting the forum.
-
I'm not experienced with nxing, but what I do know is that the subdomain you're trying to use for the websockets cannot be CloudFlare enabled
-
Can I use CloudFlare with WebSockets?
As of August 5, 2014, CloudFlare supports WebSockets for Enterprise customers only. (Announcement). WebSockets are currently only available for Enterprise customers, but will be available for other plan levels in the future.
All other customers -- Business, Pro, and Free -- should create a subdomain for Websockets in their CloudFlare DNS and disable the CloudFlare proxy ("grey cloud" the record in CloudFlare DNS Settings).
there was some code on a tut that allowed for exactly that, unfortunately i cannot find that tut at this time.
-
-
@Andi My configuration definitely works. I use it myself with CF. Maybe you could tell us a bit more what doesn't work? You're just saying that it doesn't start, but in general this has nothing to do with subdomains / proxying etc. If it really doesn't start it has something to do with NodeBB / your config. Might be helpful if you posted the errors in that case.
-
-
Yep, there is a missing comma after the
}
which is before"socket.io"
. After you fixed it paste the config in the JSON validator just to be sure there is nothing else left. -
-
@Andi no problem, happy to help