Send sourceIP to backend

Hello!
We are looking for a solution helping us distribute(balance) incoming traffic to server farm. We are interested in to use HAPROXY as load balancer. Provided some experiments we had realized we weren’t able to transmit sourceIP (clientIP) to the back-end. It is because of the back-ends placed in local area network ip space and clients connects from the Internet.**

Scheme is:

clientIP – (Internet)–>[ HA frontendIP | HA backendIP] --(LAN)–> backends

If we cannot send clientIP to backend we cannot use HAPROXY as balancer. But we want:)

Backend supports special protocol allowing receive clientIP. Is there ability integrate it to HAPROXY? May there another way solve out issue?

Hi,

You just have to configure HAProxy to use the proxy protocol to send the client IP.
https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#5.2-send-proxy

Thanks for help
Let me know. This solution uses Proxy Protocol (Proxy Protocol - HAProxy Technologies) and I have to add support it in my software working at backends. Am I right?

Yes, the proxy protocol (v1 or v2) must be activated at both ends: on your haproxy backend configuration, and on the target server configuration.

The solution could be either proxy protocol, as already mentioned, if traffic is loadbalanced on layer 4 (TCP). Indeed the proxy protocol of the same version must be activated in both HAProxy backend config and in the server farm.

Or the solution could be X-forwarded-for header, if traffic is loadbalanced on layer 7 (HTTP). This option is typically easier to use. Look at HAProxy configuration directive option forwardfor, see here.