Tracking real visitors IP address in access log

#1
Hi,

I am using OLS as a proxy for speed and security. Today we noted that no real IP gets logged in access log or error.

How to log actual IP for the visitor ? Apache logs showing

127.0.0.1 - - [11/Jan/2020:19:23:27 +0530] "GET /category/pizza HTTP/1.1" 200 93484
127.0.0.1 - - [11/Jan/2020:19:23:28 +0530] "GET /cdn/recipes/marwaelmanawy-i-cheef-recipe-19.jpg HTTP/1.1" 200 28872
127.0.0.1 - - [11/Jan/2020:19:23:29 +0530] "GET /category/ice-cream2 HTTP/1.1" 200 57692
127.0.0.1 - - [11/Jan/2020:19:23:31 +0530] "GET /category/bread HTTP/1.1" 200 57660
127.0.0.1 - - [11/Jan/2020:19:23:33 +0530] "GET / HTTP/1.1" 200 127274
 
#3
Thank you for response but its not working. Still I am able to see local IP on apache access log for that domain.

127.0.0.1 - - [13/Jan/2020:20:02:52 +0530] "GET /recipes HTTP/1.1" 200 103233
127.0.0.1 - - [13/Jan/2020:20:02:56 +0530] "GET /category/kids HTTP/1.1" 200 66504
127.0.0.1 - - [13/Jan/2020:20:02:56 +0530] "GET /cdn/users/4.jpg HTTP/1.1" 200 32626

restart services but no luck. Any change in proxy redirection?
 
#9
It works on my installation

ScreenShot2020-01-1317.05.47_meitu_1.jpg

the 88. IP are my browser , first 3 tests without OLS installed and configured

51. IP is shown when I configured OLS for reverse proxy , that is also the server IP

then the last one , once I enabled Use Client IP in Header to Yes, it records my browser IP again instead of server IP.
 
#14
I tried with other Apache installation , this time I did encounter the issue..

I also found the solution

my conf:

Code:
SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1
SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1
LogFormat "%{CLIENTIP}e %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" CLIENTIP
CustomLog  /path/to/access.log CLIENTIP
 
Top