Set frontend_ip as source IP for backend


#1

I have a server with multiple IP configured on it ( as virtual IP on eth0). I’m using Haproxy for Load balacing. Each IP has been configured/pointed to different domain name and All requests that comes to each IP address is being forwarded to different backend server by using haproxy.

Issue here, all outgoing traffic from haproxy is pass through main interface IP[eth0] [ by default]. I just wanted to set source ip for backend connection.

I tried the below config, its not working. Any idea ?

backend web1
server ss2 10.11.12.13:80 source ${frontend_ip}

frontend new1
bind 10.11.13.15:8080
mode tcp
use_backend web1


#2

Not going to work unless you either use X-Forward or the HAProxy server is the gateway.


#3

Why not just:

backend  web1
       server ss2 10.11.12.13:80 source 10.11.13.15

#4

Given solution is working.