Apache 2.4.54 - implementing mod_proxy and WebSocket Connection Upgrades
I'm sure I'm missing something obvious here, but I'm experiencing issues with Apache 2.4.54 when trying to proxy WebSocket connections to my backend server. The application runs on Node.js, and I'm using `mod_proxy` for reverse proxying. My configuration is as follows: ```apache <VirtualHost *:80> ServerName example.com ProxyPass /ws ws://localhost:3000/ ProxyPassReverse /ws ws://localhost:3000/ ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ <Location /ws> ProxyPassReverse websocket://localhost:3000/ </Location> </VirtualHost> ``` When I try to establish a WebSocket connection, I receive the following behavior in the browser console: ``` WebSocket connection to 'ws://example.com/ws' failed: behavior during WebSocket handshake: Unexpected response code: 500 ``` I've confirmed that the Node.js server is running and accessible at `localhost:3000`. Additionally, I verified that the WebSocket endpoint is working correctly when accessed directly via a client, like this: ```javascript const ws = new WebSocket('ws://localhost:3000/ws'); ws.onopen = () => console.log('Connected!'); ws.onclose = () => console.log('Disconnected!'); ``` While debugging, I checked the Apache behavior logs, and I found the following message: ``` [proxy:behavior] [pid 1234:tid 5678] (104)Connection reset by peer: proxy: behavior reading from remote server returned by /ws ``` I've tried disabling `ProxyPassReverse` for the WebSocket path and simplifying the configuration, but the scenario continues. What am I missing in my `mod_proxy` setup? Are there any additional directives I should include to handle WebSocket upgrades properly? I'm working on a application that needs to handle this. What's the best practice here?