HAProxy, websockets, "timeout tunnel" and the defaults section

  • Hi Everyone,

    I have a problem where a websocket is timing out after 60s, and the application is then refreshing the page. Without HAProxy everything works fine.

    The client sees "Connection lost, reconnecting" and the server sees

    2017-07-02 21:42:06 DEBUG (MainThread) [components.websocket_api] WS 1786937776: Connection cancelled by server
    2017-07-02 21:42:06 DEBUG (MainThread) [components.websocket_api] WS 1786937776: Closed connection

    A bunch of googling has turned up [1], which basically says the following:

            timeout tunnel 1h

    I can't find where to add this for a default config for the haproxy configuration. It's not the "Global advanced pass thru/ Custom Options" section (on the Settings main tab). I've also tried in various spots on the backends and frontends (which I am using a shared frontends) which are affected by web sockets with no luck.

    Does anyone have any hits for websockets & haproxy which is successfully working?

    [1] https://www.haproxy.com/blog/websockets-load-balancing-with-haproxy/

  • A follow-up, if I manually edit /var/etc/haproxy/haproxy.cfg, insert the 'timeout tunnel 1h', and restart haproxy by hand, everything works. So my solution is correct, I just need to figure out how to insert this into the pfsense GUI so that it is not overwritten any time the service is restarted or the config is changed via the gui.

  • Found your post whilst trying to fix a similar problem.

    I managed to get things to work with your hint.

    I simply added the "timeout tunnel 3600s" under the relevant backend -> advanced settings -> backend pass thru