WebSocket over SSL: Cloudflare

I have a website behind the cloud. I need to enable websockets over SSL without disabling cloudflare support. I have a PRO plan and therefore will not get new websocket support. I use Nginx to proxy an SSL connection with a web socket running on a node server. Now I read somewhere that a cloud flash drive can work with approved ports to support websockets. Therefore, I use 8443 for the Nginx port and another port for the node server. Using wscat, it returns a 200 error.

$ wscat -c wss://xyz.com:8443 error: Error: unexpected server response (200) 

I know that websocket is expecting code 101. However, if I am at https://xyz.com:8443 , I can see the page displayed by the node server telling me that the proxy is working. Also, when I turn off cloudflare support, websocket will start working. Any clues to make this work. I know I can create a subdomain, but I would prefer to run websocket behind the cloud.

+5
source share
1 answer

If you are trying to access this network through CloudFlare, you will need to explicitly enable web sockets in your domain before they work - regardless of port. As with a port that can pass through our network, this does not automatically mean that web sockets will be enabled or available in your domain.

You can contact our support team to request an exception to find out if they can enable it for your domain, but usually it is still only available at the business and enterprise level.

Disclaimer: I work for CloudFlare.

+5
source

Source: https://habr.com/ru/post/1204786/


All Articles