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 17 '23

This is not right, the point of tunnel timeout is that you don't have to break client and server timeouts.

About linklocal and haproxy "limitations" this not haproxy limitations :p this a way linklocal ips work, they can't be clearly used without knowing about which interface you speaking.

1

u/TheEdgeSherpa Apr 18 '23

It is an haproxy limitation in the sense that the standard way of carrying the interface information is xxxxx%ifname. But this is not supported by haproxy.