February 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728  

Categories

February 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728  

Logging on Apache

Apache server behind a proxy server

If you are using an apache server behind a proxy server, you may find that in your log files you will be given the proxy IP as the source IP of the connection. This is true,
however you can adjust the apache log settings to pass the X-Forwarded-For IP onto the apache log files.

My original log settings looked like this (httpd.conf)
1 LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” ” combined

The apache log settings dictate that %h is the source IP, in my instance it was my Proxy server. By changing my apache log format to
1 LogFormat “%{X-Forwarded-For}i %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\” %h” sitename

and then telling the site config to use the ‘sitename’ settings
view source
print?
1 CustomLog logs/rmohan-access_log sitename

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>