httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Bonner" <bkbon...@gmail.com>
Subject [users@httpd] Name-based Virtual Hosts and Reverse Proxy with ProxyPreserveHost On
Date Fri, 12 May 2006 17:00:10 GMT
Hello.

I have a Apache 2.2 setup in a reverse proxy configuration.

On the Proxy Server I have:

NameVirtualHost  *:80

<VirtualHost *:80>
    ServerAdmin admin@foo.com
    DocumentRoot /var/www/foo/html
    ServerName www.foo.com
    ErrorLog logs/www.foo.com-error_log
    CustomLog logs/www.foo.com-access_log common

    ProxyPreserveHost On

    ProxyPassReverseCookiePath     /JSPWiki /wiki
    ProxyPass               /wiki   http://app1.internal.com:8080/JSPWiki
    ProxyPassReverse        /wiki   http://app1.internal.com:8080/JSPWiki

    ProxyPass               /bb    http://app1.internal.com/phpBB2
    ProxyPassReverse        /bb    http://app1.internal.com/phpBB2

    ProxyPass              /  http://app1.internal.com/
    ProxyPassReverse  /   http://app1.internal.com/

</VirtualHost>


<VirtualHost *:80>
    ServerAdmin admin@bar.com
    DocumentRoot /var/www/bar/html
    ServerName www.bar.com
    ErrorLog logs/www.bar.com-error_log
    CustomLog logs/www.bar.com-access_log common

    ProxyPreserveHost On

    ProxyPassReverseCookiePath     /JSPWiki /wiki
    ProxyPass               /wiki   http://app1.internal.com:8080/JSPWiki
    ProxyPassReverse        /wiki   http://app1.internal.com:8080/JSPWiki

    ProxyPass               /bb   http://app1.internal.com/phpBB2
    ProxyPassReverse        /bb    http://app1.internal.com/phpBB2

    ProxyPass              /  http://app1.internal.com/
    ProxyPassReverse  /   http://app1.internal.com/
</VirtualHost>


On the internal box  (app1.internal.com) I have:

NameVirtualHost  *:80
<VirtualHost *:80>
    ServerAdmin admin@foo.com
    DocumentRoot /var/www/html
    ServerName www.foo.com
    ErrorLog logs/www.foo.com-error_log
    CustomLog logs/www.foo.com-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@bar.com
    DocumentRoot /var/www/bar/html
    ServerName www.bar.com
    ErrorLog logs/www.bar.com-error_log
    CustomLog logs/www.bar.com-access_log common
</VirtualHost>


My intent was to be able to add virtual hosts to the configuration
files of the two servers and not have to setup separate IP Addresses
for the virtual hosts to proxy to.

When I access http://www.foo.com/wiki,  it returns:
404
The requested URL /JSPWiki/ was not found on this server.

The log on the proxy server is generating this request which doesn't
make any sense since it's being proxied.

When I access http://www.foo.com/bb,  it returns:
404
The requested URL /phpBB2/ was not found on this server.


I'd prefer not to have the reverse proxy pass *everything* through to
the back end server that is doing the virtual hosting and then proxy
it again.  I don't believe this is how it should work, but I need some
advice.  Again, I was trying to get around having to configure
separate DNS Entries for the virtual hosts that sit on the same box.
I guess I can go back to this, but I thought this should work.

Any insight would be helpful.

Thanks.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message