We're moving our store to a new server with a new IP address and I'm trying to determine if there is a way to minimize the number of users who still "see" our old site during DNS propagation.

Right now, the plan is to put the old site in maintenance mode once we begin the migration so users will see a 503 message if they land on the old site.

Basically I'm trying to address this use case:

The server move is complete and we have updated the domain A record to the new IP address. Before the DNS change has completely propagated a user visits our site and is directed to the old server.

Is there any way to indicate that our site now lives at a new IP address for users who land on the old server? I know I could just redirect them by using the new IP address instead of the domain, but I would rather not use that solution if possible. Is there any way to indicate that example.com should now map to on the server level?

From other answers I've seen about dealing with DNS propagation, I suspect this is not possible. If this is not possible, I'm curious if there is a good reason for that. It seems like it would be useful for there to be a mechanism in place for a server to be able to tell a user that the domain they requested should now map to a different IP address.


There is no such mechanism. This is because it is the way DNS and its caching mechanisms work.

This is usually handled before the migration by setting the TTL for the A record to the minimum value possible, so that DNS servers keep the IP address cached for the least possible time.

However, only in rare cases you can set the TTL to zero, which would eliminate the delay completely. Usually the minimum TTL allowed by DNS provider is five to ten minutes, which is the time your site would be unavailable for some users.

Another alternative would be to setup reverse proxy on the old web server, which relays the requests and responses to the new server during the migration period. This would cause only slightly longer page load times for the visitors, but they would be able to access the site all the time.

EDIT: As noticed in the other answer, proxying loses the client IP address by default. However, proxying can be configured so that the client IP address is added as an HTTP header to the request from old server to the new server, and the new server can then apply the IP address from the header.


You can enable IP forwarding and then do forwarding of the traffic at the IP level (see http://www.debuntu.org/how-to-redirecting-network-traffic-to-a-new-ip-using-iptables/ for an example). I believe this has a benefit over proxying because you maintain the IP address of who is connecting to the website and that's logged properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.