Enable HTTP_X_FORWARDED_FOR in Haproxy

By default, Haproxy won’t forward visitor IP address to backend servers. To enable Haproxy forward visitor IP address to backend server using HTTP_X_FORWARDED_FOR header, edit haproxy.cfg

vi /etc/haproxy/haproxy.cfg

Add

option forwardfor

This can be added in blocks defaults, frontend, backend or listen.

Advertisement

Example

backend be_lamp
mode http
log global
option forwardfor
server fapi 10.0.3.106:80
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement