I have a webapp running on http://example.com:5000/
The website tries to establish a socket.io connection to that server to exchange some time critical data (multi player game).
Everything works fine that far...
Now I'm trying to get that whole thing production ready, so I want to make it available on a nicer URL: https://myapp.example.com/
To do so I configure my Apache server as follows:
ProxyPass / http://0.0.0.0:5000/
ProxyPassReverse / http://0.0.0.0:5000/
On the first glance everything seems to work - but socket.io can't switch from polling to websocket any more.
Javascript console shows this error:
socket.io.js:8 WebSocket connection to 'wss://myadpp.example.com/socket.io/?EIO=3&transport=websocket&sid=0bef58d5622f4d20b4c1d7f29c97a21d' failed: Error during WebSocket handshake: Unexpected response code: 200
It seems to be a very common setup - hiding a socket.io based webapp behind an apache proxy - but I can't find any working solutions online.
It seems that apache can't proxy ws:// connections, but I don't know what to do instead..
Found the solution here: WebSockets and Apache proxy : how to configure mod_proxy_wstunnel?