0

I am using Haproxy for load balancing.

My website run on ruby on rails.

I have done some googling and come to know to add this line

option forwardfor header X-Client

in /etc/haproxy.cfg file.

In my rails application I'm using

request.env["HTTP_X_FORWARDED_FOR"]

but this give me my master application ip

Help me to get client ip address.

1 Answers1

1

I haven't used haproxy, so take this with a grain of salt, but it looks like you're telling haproxy to use a header named 'X-Client', not 'X-Forwarded-For'. Either change the rails app to look for X-Client or change haproxy to use X-Forwarded-For.

Source: https://code.google.com/p/haproxy-docs/wiki/forwardfor