hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Apache's ProxyPreserveHost is not preserving the host?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

Apache's ProxyPreserveHost is not preserving the host?

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 12-31-2007, 06:06 AM
realrena realrena is offline
Junior Guru Wannabe
 
Join Date: Aug 2006
Posts: 68

Apache's ProxyPreserveHost is not preserving the host?


Hi all,

First of all, I would like to thank you for reading this thread.

OK here goes my problem.

I just installed lighttpd as a proxy for apache to serve static content.

What I have in apache under the Virtualhost is the following:

Code:
<VirtualHost 123.123.123.123>
    ServerAdmin xxx@xxx.com
    DocumentRoot /var/www/html/xxx/xxx
    ServerName xxx.xxx.com
    Options -Indexes +FollowSymLinks
    ErrorLog logs/xxxxx
    CustomLog logs/xxxxxx common

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://0.0.0.0:1234/
    ProxyPassReverse / http://0.0.0.0:1234/
</VirtualHost>
But somehow, when I read the logs inside /var/log/lighttpd, all I can see is that 127.0.0.1 as the host.

Can anyone tell me what is wrong??

Reply With Quote


Sponsored Links
  #2  
Old 12-31-2007, 07:23 AM
Bilco105 Bilco105 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: Manchester, UK
Posts: 1,164
Do you have a copy of an access request?

I take it the actual client requesting IP is being recorded correctly?

What version of Apache are you running, as there was a bug with similiar symptoms in Apache 2.0.52 I think.

__________________
Rob Greenwood
RedHat Certified, Unix Consultant
http://www.linkedin.com/in/bilco105

Reply With Quote
  #3  
Old 12-31-2007, 08:41 AM
realrena realrena is offline
Junior Guru Wannabe
 
Join Date: Aug 2006
Posts: 68
Hi Bilco105,

1) Below is what i see in /var/log/lighttpd/access.log
Quote:
127.0.0.1 abcd.domain.com testuser [31/Dec/2007:06:38:00 -0600] "GET /test100.zip HTTP/1.1" 200 344091 "http://abcd.domain.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
127.0.0.1 is exactly what the log has recorded.

2) I'm running Apache 2.2.3 + Lighttpd 1.4.18

Reply With Quote
Sponsored Links
  #4  
Old 01-01-2008, 05:44 AM
wKkaY wKkaY is offline
Web Hosting Evangelist
 
Join Date: Apr 2003
Location: Melbourne, AU
Posts: 539
Lighttpd will set an X-Forwarded-For header that contains the client IP. To make Apache assume the client IP from that header, you need to use modules like mod_rpaf or mod_extract_forwarded. Personally I use the former.

__________________
WK Woon
CTO | http://www.aflexi.net - A flexible Network
Building the next generation CDN platform - DEMO .... coming soon

Reply With Quote
  #5  
Old 01-02-2008, 06:14 AM
realrena realrena is offline
Junior Guru Wannabe
 
Join Date: Aug 2006
Posts: 68
Quote:
Originally Posted by wKkaY View Post
Lighttpd will set an X-Forwarded-For header that contains the client IP. To make Apache assume the client IP from that header, you need to use modules like mod_rpaf or mod_extract_forwarded. Personally I use the former.
Hmm somehow it's not working.. Still getting 127.0.0.1 in my logs

Reply With Quote
  #6  
Old 01-02-2008, 06:18 AM
Bilco105 Bilco105 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: Manchester, UK
Posts: 1,164
I'm slightly confused by your setup. You say you're using lighty to proxy requests through to Apache. However, your config shows you also using Apache to proxy requests through to something on port 1234. Is this done for a reason?. I'm trying to understand why you have multiple levels of proxying.

__________________
Rob Greenwood
RedHat Certified, Unix Consultant
http://www.linkedin.com/in/bilco105

Reply With Quote
  #7  
Old 01-02-2008, 06:59 AM
wKkaY wKkaY is offline
Web Hosting Evangelist
 
Join Date: Apr 2003
Location: Melbourne, AU
Posts: 539
You're right, Bilco105. I misread the first post (didn't see the part where he was reading off /var/log/lighttpd) and thought he was proxying Apache with lighttpd.

__________________
WK Woon
CTO | http://www.aflexi.net - A flexible Network
Building the next generation CDN platform - DEMO .... coming soon

Reply With Quote
  #8  
Old 01-02-2008, 07:55 AM
Bilco105 Bilco105 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: Manchester, UK
Posts: 1,164
I still don't get why you would have Apache proxy through to lighttpd. I would have thought the reverse would be better, what with lighty being a lot more lightweight and robust for this type of setup.

__________________
Rob Greenwood
RedHat Certified, Unix Consultant
http://www.linkedin.com/in/bilco105

Reply With Quote
  #9  
Old 01-02-2008, 05:57 PM
realrena realrena is offline
Junior Guru Wannabe
 
Join Date: Aug 2006
Posts: 68
I think I made a mistake in the Apache's ProxyPass directives.

I guess I should take out this line
Quote:
ProxyPassReverse / http://0.0.0.0:1234/
Apache's my main, and proxy some of the large static files to Lighttpd.
The reason for this (Apache as main, Lighttpd as proxy) is because I have some custom written modules for apache, and it'll take alot of time to rewrite them to lighttpd.


Last edited by realrena; 01-02-2008 at 06:02 PM.
Reply With Quote
  #10  
Old 01-02-2008, 09:04 PM
Bilco105 Bilco105 is offline
Web Hosting Master
 
Join Date: Oct 2002
Location: Manchester, UK
Posts: 1,164
If you are using lighttpd as a proxy, then you don't need any of the proxy directives in your apache configuration.

Lighttpd forwards requests with the X-Forwarded-For header, which Apache doesn't process.

You'll need to install mod_rpaf and configure it with the IP's of your proxy server(s). This will extract the IP/Host from the forwarded-for address and change the remote address of the client.

__________________
Rob Greenwood
RedHat Certified, Unix Consultant
http://www.linkedin.com/in/bilco105

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Sees Largest Gain in Host Names in December 2012 Netcraft Web Server Survey Web Hosting News 2012-12-05 13:38:09
CloudStack 4.0 Open Source Cloud Software Released as Apache Incubator Project Web Hosting News 2012-11-08 13:54:10
Apache Web Server Adds Cloud Capabilities with First Major Update in 5 Years Web Hosting News 2012-02-21 16:05:02
The Apache Software Foundation Launches Hadoop v1.0 Web Hosting News 2012-01-05 18:29:16
Oracle is the Latest Vendor to Apply Patch for Apache Killer Flaw Web Hosting News 2011-09-19 14:43:58


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?