# Proxy Protocol won't work with TCP Load balancing

**URL:** <https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815>\
**Category:** Help!\
**Created:** [July 5, 2022, 6:19pm UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815 "2022-07-05T18:19:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MBA](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@MBA](https://discourse.haproxy.org/u/MBA)\
**Post date:** [July 5, 2022, 6:19pm UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815/1 "2022-07-05T18:19:07Z")

</div>

Hello Team

We have a inhouse developed application which works on Port 5000 TCP

Our application has an interface which shows IP Address of a client when someone logs in, our requirement is to preserve the Client IP Address

We have configured HA Proxy as a load balancer/reverse proxy but we encountered following issues:

1. It never passes client IP Address to our application only load balancer IP Address is shown

2. Whenever we try accept-proxy variable we don’t see any request at application

3. We have tried numerous solutions shared over the internet but nothing works

4. Do we need to any proxy protocol implementation in our application?

Can anyone please assist or put us in direction?

---

<div class="post-metadata">

**Author:** ![Baptiste](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Baptiste](https://discourse.haproxy.org/u/Baptiste)\
**Post date:** [July 5, 2022, 7:38pm UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815/2 "2022-07-05T19:38:04Z")

</div>

Hi!

You have to set the `send-proxy` parameter of the server line in your HAProxy backend: [HAProxy version 2.4.15 - Configuration Manual](https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#send-proxy)

and yes, your application must support parsing the proxy protocol, cause it is inserted at the beginning of the first TCP payload.

---

<div class="post-metadata">

**Author:** ![MBA](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@MBA](https://discourse.haproxy.org/u/MBA)\
**Post date:** [July 6, 2022, 5:17am UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815/3 "2022-07-06T05:17:45Z")

</div>

Hi Baptiste

Thanks for the guidance, here is the configuration file:

#---------------------------------------------------------------------

# Global settings

#---------------------------------------------------------------------  
global  
log 127.0.0.1:514 local0  
chroot /var/lib/haproxy  
pidfile /var/run/haproxy.pid  
maxconn 4000  
user root  
group root  
daemon  
# turn on stats unix socket  
stats socket /var/lib/haproxy/stats  
#---------------------------------------------------------------------

# Defaults block

#---------------------------------------------------------------------  
defaults  
log global

# timeout if backends do not reply

```
timeout connect 5000ms

```

# timeout on client side

```
timeout client 50000ms

```

# timeout on server side

```
timeout server 50000ms

```

#---------------------------------------------------------------------

# Front End block for Stats

#---------------------------------------------------------------------  
frontend stats  
bind 0.0.0.0:85  
mode http  
option httplog  
option logasap  
option forwardfor header X-Client  
stats enable  
stats auth admin:admin  
stats uri /stats  
stats refresh 5s  
#---------------------------------------------------------------------

# Front End block

#---------------------------------------------------------------------  
frontend front  
bind 172.16.35.83:5001 transparent  
mode tcp  
log global  
option tcplog  
option logasap  
option forwardfor header X-Client  
default\_backend back  
#---------------------------------------------------------------------

# Backend End block

#---------------------------------------------------------------------  
backend back  
mode tcp  
balance roundrobin  
option tcp-check  
server tcp01 server\_IP:5000 send-proxy

####Config End

---

<div class="post-metadata">

**Author:** ![MBA](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@MBA](https://discourse.haproxy.org/u/MBA)\
**Post date:** [July 12, 2022, 12:16pm UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815/4 "2022-07-12T12:16:16Z")

</div>

@Baptiste Can you please refer to documentation for implementation in application?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [July 12, 2022, 2:21pm UTC](https://discourse.haproxy.org/t/proxy-protocol-wont-work-with-tcp-load-balancing/7815/5 "2022-07-12T14:21:43Z")

</div>

It’s in `doc/proxy-protocol.txt`

[http://git.haproxy.org/?p=haproxy.git;a=blob;f=doc/proxy-protocol.txt](http://git.haproxy.org/?p=haproxy.git;a=blob;f=doc/proxy-protocol.txt)
