Apache Log and AWS Load Balancer

When you are using a Apache behind AWS Load Balancer, it logs LB IP in the apache log… To correct it just make this small change in apache configuration:

From:

LogFormat "%v %h %l %u %t \"%r\" %>s %B \"%{Referer}i\" \"%{User-Agent}i\"" combined

To:

LogFormat "%v %{X-Forwarded-For}i %l %u %t \"%r\" %>s %B \"%{Referer}i\" \"%{User-Agent}i\"" combined

Leave a Reply

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