Tag Archives: Error during WebSocket handshake: net::ERR_RESPONSE_HEADER…

[note] solve the problem of error during websocket Handshake: Net:: err when using workerman and Apache to create WSS service_ RESPONSE_ HEADER…

The error during websocket Handshake: Net:: err often appears in WSS services generated by Apache proxy_ RESPONSE_ HEADERS_ Truncated , but you can connect successfully by refreshing the page several times

No way was found in the official documents, and finally in the https://github.com/ratchetphp/Ratchet/issues/645 A solution has been found

This is not a worker’s warehouse, but the solution is universal

I could say that when some client disconnects without default websockt close protocol, ratchet keeps the connection “open”, but when a new user connects then ratchet reuses somehow the last “open”(closed) connection… Because the new client uses a old “active” connection, when it sends the HTTP handshake, ratchet complains because it isn’t the default message frame.

It’s the reuse of connections that causes this problem

Modify the configuration file of Apache conf.d/ssl.conf

Add a configuration disableeuse = on in the reverse proxy, and the problem is solved

ProxyPass /wss ws://127.0.0.1:8282/wss disablereuse=On
ProxyPassReverse /wss ws://127.0.0.1:8282/wss

Reference Links

https://github.com/ratchetphp/Ratchet/issues/645

http://doc.workerman.net/faq/secure-websocket-server.html