DNS – Best Way to Change Site IP Address from End User Perspective

domain-name-systemmigration

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…

Best Answer

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.

Related Topic