LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-20-2007, 01:29 PM   #1
knarfling
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.

http://hostname.com/route1/ -> server1
http://hostname.com/route2/ -> server2
http://hostname.com/route3/ -> server3

The problem is that I am trying to access the logs on server1. When JoeUser accesses http://hostname.com/route1, 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, 04:34 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you seem to be generally misusing the word "host"... the host is the name of the server the user is requesting, e.g. "example.com" 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... http://httpd.apache.org/docs/2.0/mod/mod_headers.html

actually, this doc says it may well already be there by default... http://www.openinfo.co.uk/apache/index.html (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: http://www.gadgettrail.com/2005/01/1...g-with-apache/
 
Old 12-20-2007, 08:57 PM   #3
knarfling
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 -
Code:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
New -
Code:
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.
 
  


Reply



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 06:54 AM
Doesn't the transparent proxy keep an access log??? tzouse Linux - Networking 7 08-10-2005 03:45 PM
Strange results in /var/log/apache/access.log subt13 Linux - Security 2 08-03-2004 01:21 PM
How i can Clean up the log file of proxy? AZIMBD03 Red Hat 4 10-10-2003 08:27 AM
Squid Proxy - Log scotttiamit Linux - Networking 0 06-29-2003 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:02 PM.

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