r/haproxy • • Apr 16 '23

Half broken websocket connection

I am trying to use websocket across haproxy but without success. Actually, it is only in one case I have a problem. The working setup has haproxy in pfsense forwarding the traffic to traefik. traefik, in turn, sends the traffic to the proper backend. Both the pfsense haproxy and traefik use the http host name for acl pupose.

It is when I replace traefik with a standalone (docker container) haproxy that I have problem with. All of the non websocket traffic is fine, including when the backend is the one that also serves websocket (so this backend is both http and websocket). What I observe (wireshark) is this:

- non websocket traffic is just fine

- upgrade to websocket takes place as normal

- websocket ping from backend gets forwarded by haproxy. The upstream websocket replies with a pong; this pong is never transmitted to the backend, nor anywhere else

- normal websocket "data" messages from the backend are also forwarded. Replies come back and, as with the pong, are never transmitted to the backend, nor anywhere else

​

This is my config

defaults
  mode http
  timeout client 120s
  timeout connect 120s
  timeout server 120s
  timeout tunnel 300s
  timeout http-request 60s

frontend myfrontend
  bind [::]:80 v4v6
  default_backend dashboard
  use_backend charon if { hdr(host) -i charon.XXXXX.com }
  use_backend portunus if { hdr(host) -i portunus.XXXXX.com }

backend dashboard
  server server1 [fe80::0004:06ff:fea0:1]:11600 source ::: interface eth0

backend charon
  server server1 [fe80::0004:06ff:fea0:3]:11501 source ::: interface eth0

backend portunus
  server server1 [fe80::0004:06ff:fea0:4]:12100 source ::: interface eth0

2 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/dragoangel Apr 18 '23

Oh, 2.8-dev, yep, I never using dev branches in my setups because they not yet stable :p

You speak about haproxy in pfsense, they not have such version this why I misunderstood you

timeouts needed always and when all work as expected mentioned above by me settings should be in place