Take the 2-minute tour ×

This question already has an answer here:

Heroku in their docs talk about why you should avoid naked domains if you are dependent on IaaS or PaaS.

There is also an existing question on ServerFault, but it doesn't tackle my query.

I have understood their explanation. The part I am confused about is the caching of the ip. Heroku claims they can change the ip of their endpoint in their DNS settings and all will be good. However, don't most browsers/proxies/clients cache that ip? TTL values are not always respected. Also how quickly does that ip get propagated? Wouldn't the requests still go to the old ip?

share|improve this question

marked as duplicate by Shane Madden, Ward, Tom O'Connor, Ladadadada, Dave M Apr 23 '13 at 12:11


DNS resolvers and clients ignore TTLs at their own risk. If they're still hitting the old IP address after the TTL should have expired, it's their own fault. –  Ladadadada Apr 23 '13 at 11:03
add comment

2 Answers

You can use a CNAME for, say, www.example.com, so that it points to magic-squirrel.herokuapp.com (or whatever). magic-squirrel.herokuapp.com will resolve to whatever IP Heroku has assigned to that end point, for example, That IP can change if Heroku needs to do some network reconfiguration, but magic-squirrel.herokuapp.com will be updated to point to, say, www.example.com will follow naturally, after TTL expiration. In this case, you won't have a service disruption because of something Heroku did to manage their network.

You cannot use a CNAME for example.com, the naked domain. You instead will need to use an A record. As above, your app is running on magic-squirrel.herokuapp.com, which has an A record of Because you can't CNAME to that name, you will have to create an A record for example.com to point to Sometime later, Heroku does their network configuration, and magic-squirrel.herokuapp.com now points to Your example.com is now mysteriously broken. You will need to notice that magic-squirrel.herokuapp.com no longer is on and update your DNS accordingly.

share|improve this answer
I understand the rationale behind doing this. My question is, for a certain duration of time, ie while the old ip is cached by the resolvers, the users still endup going to the old ip. Certain proxies/browsers might not respect the TTL and still resolve to the old ip. I am trying to understand if Heroku is able to bypass this somehow, or this is considered acceptable. –  Amith George Apr 22 '13 at 22:33
I'm pretty sure Heroku doesn't do anything with the traffic misdirected to the old IP; I believe it's just assumed to be acceptable (it's the Cloud!! and cdn.memegenerator.net/instances/400x/21646781.jpg) –  cjc Apr 22 '13 at 22:40
add comment

Even though the CNAME might have a high TTL, the cached value is the alias, not the IP behind the alias(or at least should be the alias).

So while having a higher TTL on the CNAME to make use of caches, the target of the CNAME can have a very low TTL to allow changing it more often and especially allow to change it automatically without touching your own DNS records.

share|improve this answer
add comment
