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.

Example

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

Comments

Leave a Reply

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