0

We have a legacy web app running from foo.com and a new version running on demo.bar.com both from a single apache server.

The httpd-vhosts.conf file looks like this:

<VirtualHost *:80>
        DocumentRoot /dir1
        ServerName foo.com
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot /dir2
        ServerName demo.bar.com
</VirtualHost>

Currently we semi-automatically migrate apps from demo URLs to the production URLs - copying over directories, changing config files etc...

This can be easy sometimes, other times not - depending on the app complexity.

Is it possible to instruct the apache web server to internally redirect traffic from foo.com to demo.bar.com where the client does not see demo.bar.com and demo.bar.com does not see the behind the scenes redirect?

If possible, are there any implications regarding cookies, basic access authentication etc.?

zaf
  • 22,776
  • 12
  • 65
  • 95

1 Answers1

0

I think you're looking for a reverse proxy. To redirect all traffic, you could do something like this:

## in the foo.com virtual host
ProxyPassReverse / http://demo.bar.com/
gpojd
  • 22,558
  • 8
  • 42
  • 71
  • It can't be that easy...? What about cookies and basic authentication? I suppose I should try it out but will I get my leg blown off? – zaf Oct 31 '12 at 18:40
  • Cookies and authentication should work, although you might need to make some tweaks in the virtualhosts. – gpojd Oct 31 '12 at 19:26