Websocket with balancer not works

Hi,

I am having problems making requests through the balancer with websockets.

I have a client that uses socket.io.client to connect to the server.

Then there is a haproxy as a round robin balancer, which distributes connections to two identical servers but on a different port.

If I make a normal request, the balancing works correctly, but when I make one that uses websocket it does not work, I get the following error:

The file haproxy.cfg:

1   │ global
   2   │     log 127.0.0.1 local0
   3   │     log 127.0.0.1 local1 notice
   4   │     maxconn 2000
   5   │     daemon
   6   │
   7   │ defaults
   8   │     log     global
   9   │     mode    http
  10   │     option  httplog
  11   │     option  redispatch
  12   │     retries 3
  13   │     timeout connect 5s
  14   │     timeout client 50s
  15   │     timeout server 50s
  16   │
  17   │ frontend websocket_frontend
  18   │     bind *:8081
  19   │     option httplog
  20   │     option forwardfor
  21   │     option http-server-close
  22   │     acl is_websocket hdr(Upgrade) -i WebSocket
  23   │     use_backend websocket_backend if is_websocket
  24   │     default_backend http_backend
  25   │
  26   │ backend websocket_backend
  27   │     option http-server-close
  28   │     timeout tunnel 1h
  29   │     server server1 10.201.2.234:8082 check
  30   │     server server2 10.201.2.234:8084 check
  31   │

How can I solve it?

I also try with COOKIES for Sticky Sessions but it doesn`t work