httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garth Webb" <>
Subject [users@httpd] Logging X-Forwaded-For
Date Mon, 05 Jun 2006 09:01:05 GMT
Hi, I am using Apache/1.3.33 (Debian GNU/Linux) behind a proxy server
(Perlbal) which is sending the X-Forwarded-For header back with each
request.  I'm trying to create a custom log format that looks like the
stanard 'combined' format that most log parsers use.  What I have is:

 LogFormat "%{HTTP_X_FORWARDED_FOR}e %l %u %t \"%r\" %>s %b
\"%{Referer}i\" \"%{User-Agent}i\"" combined

However, most of the time my log entries contain '-' for the first
field indicating that there was no data for the X-Forwarded-For value.
 Using ngrep to monitor network traffic I have determined that this is
not the case and that the X-Forwarded-For header is being sent
correctly on each request.

The strange thing however is that direct directory requests seem to pick
up the header.  For example, if /fun is requested, apache does not log
the header correctly but issues a 301 for /fun/.  When the browser
requests this, the header is logged:

- - - [05/Jun/2006:07:16:27 +0000] "GET /fun HTTP/1.0" 301 303 "-"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060124
Firefox/" - - [05/Jun/2006:07:16:27 +0000] "GET /fun/ HTTP/1.0"
200 9028 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:
Gecko/20060124 Firefox/"

I thought possibly because Perlbal sends reproxies back requests as
HTTP/1.0 maybe apache was ignoring fields, but it since direct
directory access works, this doesn't seem to be the case.

Any ideas?

Garth Webb

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message