We use cookies on our website to ensure we provide you with the best experience on our website. By using our website, you agree to the use of cookies for analytics and personalized content.This website uses cookies. More Information
It seems like your browser didn't download the required fonts. Please revise your security settings and try again.
Barracuda Web Application Firewall
Barracuda Web Application Firewall

Logging Actual Client IP Address on the Apache Server

  • Last updated on

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:

  1. Log into the Apache server.
  2. Go to /etc/httpd/conf or /usr/local/apache2/conf path and open the file httpd.conf.
  3. Search for the string: “LogFormat “%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  4. 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
  5. Save the file and restart apache or httpd.
Last updated on