ghedipunk / PHP-Websockets

A Websockets server written in PHP.
BSD 3-Clause "New" or "Revised" License
913 stars 375 forks source link

Unexpected response code: 405 #75

Closed johnson1823 closed 6 years ago

johnson1823 commented 8 years ago

I configured my server with certyficate. I added pem and key file to options ssl and server running but when I will connect to the server I have error: WebSocket connection to 'wss://sophie.net4um.net:9000/echobot' failed: Error during WebSocket handshake: Unexpected response code: 405

Do You know how I can fix it. I need WebSocket only on wss://

Accept-Encoding:gzip, deflate, sdch Accept-Language:pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4 Cache-Control:no-cache Connection:Upgrade Cookie:mp_b5e6ddf58b2d02245a7a19005d1cec48_mixpanel=%7B%22distinct_id%22%3A%20%2215192f3f5e30-09d558a34-344b5064-c0000-15192f3f5e5cd%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Ffeniks.net4um.net%3A8000%2F%22%2C%22%24initial_referring_domain%22%3A%20%22feniks.net4um.net%3A8000%22%7D; __utma=21560505.883086343.1453694564.1453694564.1453694564.1; __utmz=21560505.1453694564.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=93540994.123603601.1458600258.1458600258.1458600258.1; __utmz=93540994.1458600258.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) Host:sophie.net4um.net:8001 Origin:https://sophie.net4um.net Pragma:no-cache Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits Sec-WebSocket-Key:XtlO0/7bx64B8U11fe6Urw== Sec-WebSocket-Version:13 Upgrade:websocket User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Xaraknid commented 8 years ago

Something is misconfigured in testtlssock.php because error 405 is an http level error referring to

405 Method Not Allowed

johnson1823 commented 8 years ago

so I don't know why: my configuration: $options = array( 'ssl' => array( 'peer_name' => 'sophie.net4um.net', 'verify_peer' => false, 'local_cert' => 'path/to/sophie.net4um.net.pem', 'local_pk' => 'path/to/sophie.net4um.net.key', 'disable_compression' => true, 'SNI_enabled' => true, 'ciphers' => 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK', ), );

And file pem I downloaded from StartCom. Where I made a mistake?

jeffscm commented 6 years ago

Old but i just hit this problem, any light on it? Thanks

ghedipunk commented 6 years ago

Some have had luck using nginx as the TLS endpoint, and passing the WebSocket data on from there.