Websocket PHP - 400 Bad Request

I run a websocket server proxied via Cloudflare. Connecting to it via javascript works but when i trie to connect to it via php I get a 400 bad request result.

The port i am using is 2053 and the connection uses stream_socket_client

Example

stream_socket_client('ssl://mydomain.com:2053', $errno, $errstr, ini_get("default_socket_timeout"), STREAM_CLIENT_CONNECT, $context);

This is the result (cli)

string(316) "HTTP/1.1 400 Bad Request
Server: cloudflare
Date: Mon, 22 Jan 2024 13:49:26 GMT
Content-Type: text/html
Content-Length: 155
Connection: close
CF-RAY: -

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

I have enabled websockets in Cloudflare

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