I have a single external address that points to a server that is serving multiple domains using virtual hosts. I would like to serve one of the virtual hosts on a new physical machine and am trying to use a reverse proxy to make this happen.
On the main server the configuration looks like this (names changed to protect the guilty):
<VirtualHost *:80> DocumentRoot /abc/htdocs/virtual/swnc ServerName swnc.org <Directory "/abc/htdocs/virtual/swnc"> Options FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
On the new physical machine I have the domain referenced above configured with:
<VirtualHost *:80> ServerName swnc.org ProxyPass "/" "http://www.example.org/virtual/swnc" ProxyPassReverse "/" "http://www.example.org/virtual/swnc" </VirtualHost>
This configuration works but the resulting URL is what is specified in the
ProxyPass statement above rather than the "real" URL which should be
I tried adding
ProxyPreserveHost On in the configuration but it did not make any difference. Is there something I am missing or is it simply not possible to proxy the request to the new machine and retain the "real" domain name?
Here are the Apache configuration files on the old server and the new server using the suggestions from Stephen's answer.
<VirtualHost *:80> ServerName ncdrought.org ProxyPass "/" "http://new.ncdrought.org" ProxyPassReverse "/" "http://new.ncdrought.org" </VirtualHost>
<VirtualHost *:80> ServerName new.ncdrought.org DocumentRoot /var/www/ncdrought.org <Directory "/var/www/ncdrought.org"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>