Apache Websocket Proxy dropped connections

I'm trying to proxy a websocket through Apache 2.4.7 (running on Ubuntu). The connection is correctly established but if the browser or the server don't send each other data for some time (few minutes) new messages coming from the server are not delivered to the browser.
Furthermore, nor the browser or the service on the server seem to realize the connection is somehow broken (they don't throw any error at all).

How can I configure the server in order to avoid this issue?

This is my configuration:

ProxyRequests Off ProxyPass /somepath ws://127.0.0.1:6080/ retry=60 keepalive=On timeout=9999 ttl=9999 ProxyPassReverse /somepath ws://127.0.0.1:6080/ retry=60 
2

1 Answer

I was having the same issue and resolved it by configuring ProxyWebsocketIdleTimeout, with a value of 300 (seconds). There's documentation here:

Your socket should have a keepalive message. Mine does every 30 seconds, but the connection was dropping because my ProxyWebsocketIdleTimeout directive was obviously less than 30 seconds. I set it to 300 seconds (5 minutes) for good measure and the issue was resolved.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like