Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-20-2007, 02:29 PM   #1
LQ Newbie
Registered: Aug 2006
Distribution: RHEL, Fedora
Posts: 11

Rep: Reputation: 1
Apache Proxy log issue

I am running Apache 2.0.52 on a RHEL4 server. I have set up a proxy so that different servers can process different URL's. -> server1 -> server2 -> server3

The problem is that I am trying to access the logs on server1. When JoeUser accesses, the logs on server1 show a request coming from my proxy. I have tried adding ProxyPreserveHost On to my conf file, but I still get the proxy IP address in the log rather than JoeUser's host information.

Is there a way to forward the host information that the proxy receives to the individual servers? I realize that I can see that on the proxy server logs, but because of the number of connections, it becomes difficult to sort out each server.

Thanx for any help.
Old 12-20-2007, 05:34 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
you seem to be generally misusing the word "host"... the host is the name of the server the user is requesting, e.g. "" that would be the contents of the "host" header and that is what is preserved in that directive. what you appear to want is to add an X-Forwarded-For header. I've not added a header in apache myself, but there doesn't *appear* to be any dedicated config to add it, but just use the generic header module to add it...

actually, this doc says it may well already be there by default... (search for x-forwarded-for) and IF that header is already there then you'd just need to change the log strings to pull the ip from that header instead of the raw connection data:
Old 12-20-2007, 09:57 PM   #3
LQ Newbie
Registered: Aug 2006
Distribution: RHEL, Fedora
Posts: 11

Original Poster
Rep: Reputation: 1
Thumbs up That Worked! Thank you

Thank you Very Much!! That was exactly what I needed. All I needed to do was to replace the %h in the LogFormat directive with %{X-Forwarded-For}i.

Previous -
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
New -
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
Now I am getting what I need from the logs. I really appreciate your help.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add date n time in proxy access.log sunlinux Linux - Networking 3 08-23-2007 07:54 AM
Doesn't the transparent proxy keep an access log??? tzouse Linux - Networking 7 08-10-2005 04:45 PM
Strange results in /var/log/apache/access.log subt13 Linux - Security 2 08-03-2004 02:21 PM
How i can Clean up the log file of proxy? AZIMBD03 Red Hat 4 10-10-2003 09:27 AM
Squid Proxy - Log scotttiamit Linux - Networking 0 06-29-2003 05:17 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration