How to do port forward by domain in TCP mode?

I am using use-server to separate https with different domain requests, but sometimes it will go to wrong server with same url, but when I wrote test python script to send https request 100 times per second, It couldn’t reproduce the wrong situation. Any ideas?

Test URL: (sometimes a few request will go web2) (sometimes a few request will go web1)


frontend http_https_8080
  mode tcp
  bind *:8080
  tcp-request inspect-delay 30s
  tcp-request content accept if HTTP

  use_backend http_server if HTTP
  default_backend local_https_server

backend http_server
  mode tcp
  tcp-request content accept if { req_ssl_hello_type 1 }
  tcp-request inspect-delay 30s

#domain agent
  use-server web1 if { hdr_dom(Host) -i }
  use-server web2 if { hdr_dom(Host) -i }
  server web1
  server web2

frontend local_https_9443
  mode tcp
  bind  *:9443 ssl crt /etc/haproxy.pem
  default_backend http_server

backend local_https_server
  mode tcp
  option ssl-hello-chk
  server localhttps localhost:9443


You are using TCP mode but try to use HTTP header filtering: hdr_dom(Host).