hi rick,

I have configured apache2 with a reverse proxy to some internal
web servers, also running apache2.

Example:

<VirtualHost *:80>
         ServerName something.whatever.net.au
         ServerAdmin [EMAIL PROTECTED]
         DocumentRoot /var/www/
         <Proxy *>
                 Order allow,deny
                 allow from all
         </Proxy>
         ProxyPass / http://10.11.12.3:80/
         ProxyPassReverse / http://10.11.12.3:80/
</VirtualHost>

the only thing i can see missing from this vhost config is

ProxyRequests Off


Trouble is, when host 10.11.12.3 replies with a Location: header,
e.g.

Location: http://10.11.12.3/test/perl-redirected.html

the reverse proxy does not rewrite the header. I would expect the
above header to reach the client in the following form:

Location: http://something.whatever.net.au/test/perl-redirected.html

The Apache docs here <http://httpd.apache.org/docs/2.2/mod/mod_proxy.html>
indicate that

   "This directive lets Apache adjust the URL in the Location,
    Content-Location and URI headers on HTTP redirect responses.
    This is essential when Apache is used as a reverse proxy to
    avoid by-passing the reverse proxy because of HTTP redirects
    on the backend servers which stay behind the reverse proxy."

I'm stumped!

also from the apache 2.2 ProxyPassReverse docs:

"Note that the hostname used for constructing the URL is chosen in
respect to the setting of the UseCanonicalName directive."

do you have UseCanonicalName on or off?

if its off, then that might be your problem, because apache will be
using the reverse proxy as the hostname:

http://httpd.apache.org/docs/2.2/mod/core.html#usecanonicalname

"With UseCanonicalName Off Apache will form self-referential URLs
using the hostname and port supplied by the client if any are supplied
(otherwise it will use the canonical name, as defined above). These
values are the same that are used to implement name based virtual
hosts, and are available with the same clients. The CGI variables
SERVER_NAME and SERVER_PORT will be constructed from the client
supplied values as well."

if this is the issue, then you can either set UseCanonicalName to on,
or use the ProxyPreserveHost directive:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost

"When enabled, this option will pass the Host: line from the incoming
request to the proxied host, instead of the hostname specified in the
ProxyPass line."

hope that helps.

cheers
justin
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to