Skip to main content

Posts

Showing posts from October, 2020

Logging Actual Client IP Address on the Apache Server

  To extract and log the actual client IP address from the X-Forwarded-For header of a request using an Apache server, make the following changes to the server: Log into the Apache server. Go to  /etc/httpd/conf  or  /usr/local/apache2/conf path  and open the file  httpd.conf . Search for the string: “ LogFormat “%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined ” Change the  %h  to  %{X-Forwarded-For}i . The string now appears as “ LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" "  combined ” Save the file and restart apache or httpd.