HAProxy community

HAProxy with TCP requests mirroring

Hello,

I’m trying to setup HAProxy in tcp mode with functionality of tcp proxy & mirroring for tcp requests payload. (the app layer could be any protocol over TCP)

The mirroring should be done for each tcp req in the frontend.
Currently I was able to achieve mirroring for the first tcp req in a new session.
Any additional tcp reqs on the existing session are not mirroring to the spoa.
Is if it’s possible to achieve such functionality ?

Following is my configuration:

haproxy.conf:

backend customer_db
mode tcp
server customer_db_server 54.172.95.6:80 # simple webserver for testing
tcp-request content accept

backend mirroragents
mode tcp
balance roundrobin
timeout connect 5s
timeout server 2m
server agent1 localhost:2222

frontend port_80
filter spoe engine mirror config /etc/haproxy/mirror.conf
tcp-request content send-spoe-group mirror check-client-ip-group if { req.len gt 0 }
option tcplog
bind :80 # define what port to listed to for HAProxy
default_backend customer_db

mirror.conf

[mirror]
spoe-agent mirror
log global
groups spoe-tcp-req-group
use-backend mirroragents
maxconnrate 100
max-frame-size 1000
timeout hello 3s
timeout idle 1m
timeout processing 7s
no option pipelining
no option async

spoe-group spoe-tcp-req-group
messages spoe-tcp-req

spoe-message spoe-tcp-req
args arg_body=req.payload(0,0)

Many thanks in advance for any help!!.
Alon