Apache Reverse proxy to fight DNS propagation

Douwe asked:

I have been following this tutorial to set up a reverse proxy. I have moved some sites to a new server, and changing the DNS for a lot of alias domains is going to take a while. To minimize issues, I want to redirect all traffic to the new location with a reverse proxy.

It does work, but I get a default page on the new server while configuration is exactly the same and editing my hosts file does work.

This is the config that I’m using:

 <VirtualHost *:80>
        ServerName domain.com
        ServerAlias *.domain.com
        ServerAlias domain2.com *.domain2.com
        ErrorLog ${APACHE_LOG_DIR}/proxy-error.log
        CustomLog ${APACHE_LOG_DIR}/proxy-access.log combined
        ProxyRequests Off
        ProxyPass / http://x.x.x.x/
        ProxyPassReverse / http://x.x.x.x/

Does it has something to do with the fact that I use http://ip_adress/ for the ProxyPass condition?

My answer:

This setup requires that the original Host: header be passed onward from your proxy to the new origin server.

This is done with ProxyPreserveHost:

    ProxyPreserveHost On

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.