Enable Real Client IP Visibility in Percona PostgreSQL Behind HAProxy

Issue Summary

We have a Percona PostgreSQL cluster deployed behind HAProxy for load-balancing and high availability.
Currently, PostgreSQL logs and pg_stat_activity only show the HAProxy IP as the client address instead of the actual application/client IP.

This prevents us from:

  • Enforcing IP-based access control in pg_hba.conf

  • Auditing real user connections

  • Meeting security and compliance requirements

Expected Behaviour

Percona PostgreSQL should receive and record the original client IP when connections are proxied via HAProxy.

This should allow:

  • pg_stat_activity.client_addr to show the real IP

  • PostgreSQL logs to record real client IP

  • pg_hba.conf to work with real client networks


pls help how we can achieve this