Information about X-Forwarded-for

davidhan

Member
Sep 18, 2014
8
0
1
technewonline
cPanel Access Level
Website Owner
Hello everyone.
Can someone suggest the best way of reading the X-Forwarded-for header and putting the IP in the apache logs as well as the real IP as I've been experimenting with putting a proxy cache infront of my apache server to see if it speeds things up.

Problem is now of course all the requests in the logs show the proxy ip instead of the actual IP, ideally i'd like the logs to show the actuall ip and what x-forwarded-for is coming up with.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

You will likely need to modify the LogFormat entry in your Apache configuration file. I found several results with potential solutions when searching for entries such as "LogFormat "%{X-Forwarded-For}" on Google. Remember to follow our documentation when editing the Apache configuration:

Advanced Apache Configuration - EasyApache - cPanel Documentation

Thank you.