WebSockets with Varnish and Nginx
thruflo.com
thruflo.com
For now, Java-based servers (using netty) and node.js may be a better idea.
The question is, how could I set up multiple servers on the same port? Or what else do I need to put in front of Varnish to route WebSocket connections elsewhere?
I'm starting to think this use case is not easy to solve under one IP address.
No need for Varnish for proxying your websockets.
https://www.varnish-cache.org/docs/trunk/tutorial/websockets...
There are reasons to do either but I've not come up with a definitive reason to go one way or another.
As for the handling of the websockets, setting the pipe_timeout variable in the vcl file would release any persistent, yet silent, connections.
However, I really think that nginx should implement proper support for WebSockets by now. I have requested this previously, but the request got unanswered.
https://www.varnish-cache.org/docs/3.0/tutorial/compression....
Of course if you are just forwarding to another backend you may lose this.