ProxyPassReverse Incorrectly Handling Redirects

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

 



Hello All-

I'm using Apache as a reverse proxy for multiple applications on a
single machine. These applications are running on various ports. I am
using mod_proxy to handle requests and mod_proxy_html to rewrite links.
Here's my setup:

Windows Server 2003 (no choice...)
Apache 2.2.6
mod_proxy_html 3

Here's the common part of my http_proxy.conf configuration file (which
I'm including using Include conf/http_proxy.conf from httpd.conf):

LoadModule proxy_module modules/mod_proxy.so 
LoadModule proxy_http_module modules/mod_proxy_http.so 
LoadModule headers_module    modules/mod_headers.so
LoadFile modules/mod_proxy_html/libxml2.dll
LoadFile modules/mod_proxy_html/zlib1.dll
LoadFile modules/mod_proxy_html/iconv.dll
LoadModule proxy_html_module modules/mod_proxy_html/mod_proxy_html.so
ProxyRequests Off 

ProxyHTMLLinks a href
ProxyHTMLLinks area href
ProxyHTMLLinks link href
ProxyHTMLLinks img src longdesc usemap
ProxyHTMLLinks object classid codebase data usemap
ProxyHTMLLinks q cite
ProxyHTMLLinks blockquote cite
ProxyHTMLLinks ins cite
ProxyHTMLLinks del cite
ProxyHTMLLinks form action
ProxyHTMLLinks input src usemap
ProxyHTMLLinks head profile
ProxyHTMLLinks base href
ProxyHTMLLinks script src for

ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
onmouseover onmousemove onmouseout onkeypress \
onkeydown onkeyup onfocus onblur onload \
onunload onsubmit onreset onselect onchange
 
<Proxy *> 
  Order deny,allow 
  Allow from all 
</Proxy>

ProxyHTMLExtended On


And here's the portion that defines one of the applications:

Alias /wtbasement "C:\rails\wtbasement\public"  
<Directory "C:\rails\wtbasement\public"> 
	Options Indexes FollowSymLinks 
	AllowOverride none 
	Order allow,deny 
	Allow from all 
</Directory> 

ProxyPass /wtbasement/images ! 
ProxyPass /wtbasement/stylesheets ! 
ProxyPass /wtbasement/javascripts ! 
 
ProxyPass /wtbasement/ http://127.0.0.1:3004/ 
ProxyPass /wtbasement http://127.0.0.1:3004/ 
#ProxyPassReverse /wtbasement/ http://127.0.0.1:3004/ 

# reverse proxy link mapping
ProxyHTMLURLMap http://127.0.0.1:3004/ /wtbasement
<Location /wtbasement/>
	ProxyPassReverse /
	SetOutputFilter  proxy-html
	ProxyHTMLURLMap / /wtbasement/
	ProxyHTMLURLMap /wtbasement /wtbasement
	RequestHeader    unset  Accept-Encoding
</Location>


In this case, I'm running an app called wtbasement on port 3004. The
regular proxy functionality seems to work fine, i.e.
http://localhost/wtbasement displays the home page properly. The
mod_proxy_html portion seems to work fine as well, i.e. links inside
html documents get rewritten from <a href="foo.htm"> to <a
href="wtbasement/foo.htm">. 

The problem comes in when the application sends redirects to relative
pages. If the application redirects to /main/list, my browser goes to
this page:

http://localhost/main/list 

when I want it to go to

http://localhost/wtbasement/main/list

I understand that this is the purpose for ProxyPassReverse, but it
doesn't seem to be happening the way I intend. I've tried calling
ProxyPassReverse inside and outside of the Location tags and it has no
effect. For reference, a similar issue was brought up in
http://marc.info/?l=apache-httpd-users&m=116350222200386&w=2 but it
didn't seem that there was any solution (the one listed did not work).

The error log for the case mentioned above has the following:

[Mon Oct 29 10:42:01 2007] [error] [client 127.0.0.1] File does not
exist: C:/apache/htdocs/main, referer: http://localhost/wtbasement/main

Apprently it is trying to redirect to C:/apache/htdocs/main instead of
http://localhost/wtbasement/main. How can I make it redirect
appropriately?

Thanks in advance for your help.


Andy Selvig




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