Always use HTTPS: redirect ws to wss for WebSocket

Hi,

What would be the correct way of setting up ws:// to wss:// redirect for WebSocket connections?

I am currently redirecting unencrypted traffic to https/wss on my end, but I’d like to move this to the Cloudflare’s edge.

I’ve tried enabling ‘Always Use HTTPS’, and it works for http://, but WebSocket connections to ws:// protocol are redirected to https:// instead of wss://. This makes the WebSocket client library I use (python’s websocket-client) fail to connect.

Any tips?

Thanks, Anatoliy

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