Best way to change site IP address - from the end user perspective?

I did read a bunch of relevant Q/A here but I am still not sure what the best answer is.

I'm moving a couple of sites from IP address "1.a.b.c" to "2.d.e.f". As of right now in the existing DNS I set all TTL to 300 seconds, and I have a new DNS zone ready to be used (on AWS Route 53), with new nameservers and all TTLs at 60 seconds. So I believe I am ready, from a DNS perspective. Post-move, after a few days I will set TTL to more reasonable numbers at Route 53.

I've warned all my users about the move and I have a defined window of time for the move. I told them that once the move is complete and if 24 hours have gone by and they still see the old (locked) sites, they should reboot their computer to force a local DNS cache flush.

I do not understand how the user's browser (cache) plays a role in this. My own experiments with a local hosts file (Win7) tell me there is something about the browser that is not letting the old IP address go -- I had to go to history->clear everything in order to get the new site location to show up, even after ipconfig /flushdns

(EDIT) - I do not have root access to the old server, so I can't implement the accepted answer to this question.

Question: I really don't want my users to have to deal with that, so is there something I can do to force all the browsers out there to re-cache? And if so, how long do I leave it turned on?

Thanks...


Solution 1:

No, you can't. The problem is that DNS response can be cached anywhere between user and DNS server and there is no way to invalidate them.

What you can however do - as soon as you have data in sync and your second site is ready, you can reconfigure original server to behave as a proxy and pass all requests to the new location.

This way, you can achieve almost 0s of downtime of your website.

Update

If you don't have root access there are several options:

  • Perform proxying in PHP

  • Configure proxy on the second server (if you have root access there), switch DNS and when you are ready change proxy to webserver

  • This method can be source of problems Have 2 addresses (www.domain.tld and www2.domain.tld). Configure www2 (which is the same as www) and set correct DNS records. Then prepare www version of your site and do the switch of the DNS. Set redirect of all requests on old server to www2 subdomain.

Solution 2:

In theory, setting the domain's TTL to something low and waiting for that change to take place, then changing the IP, should result in a near-transparent migration. After all, that's the whole point of the TTL being configurable.

In practice, people misconfigure things and tools break. That's why you may need to provide instructions to your users to clear their local cache if things don't work right.

You're not doing anything wrong though.

Solution 3:

Inevitably your old address will be cached and used for a long time -- mostly by bots.

How I'd do it:

  • Create an A record, for example www2.yourdomain.com, pointing to new IP. This record should never have been used before; therefore never cached.
  • Redirect queries on old server to www2.yourdomain.com
  • Monitor redirects, and when traffic subsides to an acceptable level, remove old server.
  • And finally once old server is removed, redirect www2.yourdomain.com to www.yourdomain.com.

Be sure to use 301 Permanent redirects. https://en.wikipedia.org/wiki/HTTP_301