WebSockets doesn't work on cloudflare

Connections to my WebSocket server began to time-out (server doesn’t get connection) when I turned on Cloudflare (no matter if the “WebSockets” option in the Network panel is turned on or turned off).
It is not a problem with SSL, because I tested it on Flexible, Full, and Full (strict).
I’m using ports 9502 - 9512.
Connections to WS work only when I “Pause Cloudflare on this site”.

OK, my bad - websocket works but only on this ports: developers.cloudflare .com/fundamentals/reference/network-ports/
Is there a way to forward ports? like 2502-2512 → 9502-9512

Cloudflare’s proxy will only work on these ports:

You can turn off the proxy and connections will go direct to your origin bypassing all Cloudflare services.

Other options are to have a different subdomain for each websocket port but just using HTTPS (port 443), say ws9502.example.com, ws9503.example.com, etc, and use origin rules to have the proxy forward requests to the correct port at your server.

Or you can use Spectrum to proxy any TCP/UDP port but that requires an enterprise account so cost rules this out for most users.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.