HAProxy community

Is it possible to send traffic back to same port as it was received?

I need to send traffic back to the same port on which load balancer receives the request.
Is it possible with haproxy or not?


Do you mean mirroing the traffic back to the client and the same TCP connection (without opening any backend server connection)? No, this cannot be done.

So basically,
I have 2 servers and I created an HA Proxy LB on another server.
Now traffic will come to any port on LB and I need to send the traffic back to any one of server on the same port.

Ah ok, yes, that is indeed possible.

Configure the port range you require on the frontend, for example:

bind :1-21,:23-65536

And on the backend, only specify the server, do not specify a destination port. Then haproxy will connect to the use the frontend port as on the frontend to connect to the server:

backend servers
 server s1
 server s2