I'm considering Cloudflare's CNAME flattening that allows a rough equivalent of CNAMEs on apex domains.
My impression of that article is that anyone who queries them sees it as an A record (with a 5 minute TTL passed on from Heroku), but behind the scenes, they look up the IP of a given hostname and return that.
But because they expose it as an A record, won't that 5 minute TTL mean that others may cache the returned IP for at least 5 minutes? And more if ISPs etc happen to cache it for longer.
As I understand it, a regular CNAME will only cache a hostname (like
foo.herokuapp.com.) through the DNS system, and I guess the hostname-to-IP lookup happens as late as possible, and so won't be as likely to be cached for long.
Does this, then, mean that if Heroku's IP changes, a regular CNAME would handle the new IP very quickly, but Cloudflare's CNAME flattening might take minutes or more?
If Heroku IPs can change as often as each time you deploy or restart dynos (do I have that right?), this seems like it could cause a lot of issues. Yet I haven't been able to find reports of such issues. So does this mean I have some incorrect assumption, above?
Could it be the case that the above applies if the flattened CNAME is set up for "DNS only" (gray cloud in the UI), but with "Traffic to the hostname will go through Cloudflare" (orange cloud in the UI), DNS will resolve to Cloudflare's proxy server IPs, and the hostname-to-IP lookup happens in their proxy servers and so won't be cached?