You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dirk-Willem van Gulik <di...@webweaving.org> on 2002/08/18 12:58:48 UTC

Re: How can I resolve this problem ?

On Sun, 18 Aug 2002, zhuml wrote:

> 	I chose Apache 1.3.26 as my web-server running on Port 81. Instead, I use
> Squid running on Port 80 as a reverse proxy pointing Port 81.
>     The problem came. IP address recorded in apache log files was the same:
> [127.0.0.1] . Obviously, it should be 127.0.0.1 , because all the web
> requests sent to apache server were from Squid.
>     I know that is a key-word in HTTP header -- HTTP_X_FORWARDED_FOR, it
> reocords the real IP address which I really need to log in apache log
> files.
>     How can I configure apache to log the real IP address ?

Check out the docs, specifically:

	http://httpd.apache.org/docs/logs.html

or more specifically:

	http://httpd.apache.org/docs/mod/mod_log_config.html

Two options are:


%...{FOOBAR}e:  The contents of the environment variable FOOBAR
%...{Foobar}i:  The contents of Foobar: header line(s) in the request
                sent to the server.

So you are after the ENV virable HTTP_X_FORWARDED_FOR or the Header line
'X-Forwarded-For'.

So tryt instead of this:

	"%v %h %l %u %t \"%r\" %>s %b"

this:

	LogFormat "%v %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common2
	CustomLog logs/access_log_common2 common2

Dw.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: How can I resolve this problem ?

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.

On Sun, 18 Aug 2002, J. Greenlees wrote:

> wow, dirk-Willem, you are psychic. you answered the question 12 hours
> before it was asked....according to the time stamps at least. ;)

Welcome to the world of international time and the complexity of date
lines and time zones.

Dw


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: How can I resolve this problem ?

Posted by "J. Greenlees" <ja...@shaw.ca>.
wow, dirk-Willem, you are psychic.
you answered the question 12 hours before it was asked..according to the 
time stamps at least. ;)

Dirk-Willem van Gulik wrote:
> On Sun, 18 Aug 2002, zhuml wrote:
> 
> 
>>	I chose Apache 1.3.26 as my web-server running on Port 81. Instead, I use
>>Squid running on Port 80 as a reverse proxy pointing Port 81.
>>    The problem came. IP address recorded in apache log files was the same:
>>[127.0.0.1] . Obviously, it should be 127.0.0.1 , because all the web
>>requests sent to apache server were from Squid.
>>    I know that is a key-word in HTTP header -- HTTP_X_FORWARDED_FOR, it
>>reocords the real IP address which I really need to log in apache log
>>files.
>>    How can I configure apache to log the real IP address ?
>>
> 
> Check out the docs, specifically:
> 
> 	http://httpd.apache.org/docs/logs.html
> 
> or more specifically:
> 
> 	http://httpd.apache.org/docs/mod/mod_log_config.html
> 
> Two options are:
> 
> 
> %...{FOOBAR}e:  The contents of the environment variable FOOBAR
> %...{Foobar}i:  The contents of Foobar: header line(s) in the request
>                 sent to the server.
> 
> So you are after the ENV virable HTTP_X_FORWARDED_FOR or the Header line
> 'X-Forwarded-For'.
> 
> So tryt instead of this:
> 
> 	"%v %h %l %u %t \"%r\" %>s %b"
> 
> this:
> 
> 	LogFormat "%v %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common2
> 	CustomLog logs/access_log_common2 common2
> 
> Dw.
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org