[users@httpd] Logging X-Forwaded-For

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:1.8.0.1) Gecko/20060124
Firefox/1.5.0.1"
221.249.96.54 - - [05/Jun/2006:07:16:27 +0000] "GET /fun/ HTTP/1.0"
200 9028 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1)
Gecko/20060124 Firefox/1.5.0.1"

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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux