[users@httpd] Name-based Virtual Hosts and Reverse Proxy with ProxyPreserveHost On

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

 



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