Re: [users@httpd] ProxyPresearveHost question / situation

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

 



DF wrote:
Hi,


We have the following setup:

'Net  <----> Load balancer <-----> Apache 2.2.2  <------->  Apache 1.3.34

*Note: Apache 2.2.2 and 1.3.34 are on the same server, listening on different ports.

Apache 2.2.2 is the front end web server that receives the clients requests. It handles all requests except for URLs asking for files with a particular extension. These files are processed by a module that only works with Apache 1.3.x. For those "special" files, Apache 2.2.2 performs a rewrite(mod_rewite) that hands off the processing to Apache 1.3.34. To get this to work, I had to use the ProxyPreserveHost On option so Apache 1.3.34 would know what host to use. Works great except for one domain. This "special" domain also has forums that are running on a set of internal web servers. So now I need to get a "normal" reverse proxy working, ProxyPass/ProxyPassReverse. The problem is, this won't work with ProxyPreserveHost On.

Here is the config (shared by Apache 2.2.2 and Apache 1.3.34):

<VirtualHost 192.168.107.37>
 ServerName www.domain.com
 ServerAlias domain.com
 DocumentRoot /data/domain.com

 <IfDefine REVERSE_PROXY>
   ProxyPreserveHost On
   RewriteEngine on
   RewriteCond %{LA-U:SCRIPT_FILENAME} \.ext$ [NC]
   RewriteRule .* http://192.168.107.37:8080%{REQUEST_URI} [P,L]
   ProxyPassReverse / http://192.168.107.37:8080/
 </IfDefine>

 # Push through to forum server (proxy)
 RewriteEngine On
 RewriteRule /info/forum/(.*) /community/forum/ [R,L]

 <IfModule mod_proxy.c>
   ProxyPass /community/forum/ http://forums.domain.com/
   ProxyPassReverse /community/forum/ http://forums.domain.com/
 </IfModule>

</VirtualHost>

With this configuration:
- When I hit Apache 2.2.2 for anything but files with the 'ext' extension, it handles it with no problems. - When I hit Apache 2.2.2 for any file ending with .ext, it get rewritten and passed to apache 1.3.34.

Problem:
- When I hit Apache 2.2.2 with a request for /community/forum/ I just get redirected to the sites home page, I don't get the forums as expected. ProxyPresearveHost is doing it's job of preserving the host, but in this case I don't want it to. I tried putting ProxyPreserveHost Off before the first ProxyPass entry, same result. I tried putting it at the bottom of the <IfDefine REVERSE_PROXY>, same problem. Can PresearveProxyhost not be turned on then off again?


Notes:
1) Apache 2.2.2 and Apache 1.3.34 are using the same Vhost config file, defines are used to control "who sees what".

2) Apache 2.2.2 is started with -DREVERSE_PROXY so it will process the REVERSE_PROXY block, while apache 1.3.34 is not passed any parameters, so it ignores the REVERSE_PROXY block.


Another question, have I over complicated the situation and there is a better solution?



Thanks,


David f.

Here is some more info...

These are the headers going back getting sent to the browser:

http://www.domain.com/community/forum/

GET /community/forum/ HTTP/1.1
Host: www.domain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 301 Moved Permanently
Date: Fri, 14 Jul 2006 15:52:14 GMT
Server: Apache-AdvancedExtranetServer/1.3.31 (Mandrakelinux/7.1.101mdk) PHP/4.3.8 mod_ssl/2.8.19 OpenSSL/0.9.7d
Location: http://www.domain.com/
Content-Type: text/html; charset=iso-8859-1
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked



So it looks like it's not even trying the proxy, but just redirecting right back.





---------------------------------------------------------------------
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