Moving website to new server using proxy pass to avoid domain propagation problems

Sometimes we need to move website to new server, with new IP. In such cases the most problematic part is domain propagation period. In that period part of website users will hit the old server and part of website users will hit new server. The problem is when they will submit some data – if they were on old server then we will have inconsistent data between old and new server. Is there solution for this ?

Yes. Solution is called “proxy pass”. Its a technique which allows to pass the request to one server to other server. All you need to do is to add following config to your Apache vhost:

SSLProxyEngine on

SetEnv proxy-sendcl 1
ProxyPreserveHost On

ProxyPass / https://12.12.12.12/
ProxyPassReverse / https://12.12.12.12/

After reloading apache all request to current server for domain defined in vhost will be redirected to server with IP 12.12.12.12. Thanks to  “ProxyPreserveHost On” apache on other side will be able to figure out what vhost should support request.

 

Leave a Comment.