大网数据广告活动
服务器运维问答

How instant are Heroku IP changes with Cloudflare CNAME flattening compared to regular CNAMEs? How likely to happen?

· 52CE 我爱测

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 Hero…

问题原文

原帖链接 · Henrik N · CC BY-SA 3.0

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?

已采纳解答

原帖链接 · mjsa · CC BY-SA 3.0

It is actually possible to enter in a custom DNS TTL into Cloudflare (when adding a DNS record); it is however right to say that there will be some DNS Recursors that unfortunately will not respect low TTLs.

There is a solution to this, when a subdomain is orange-clouded (i.e. passing through Cloudflare); the public IP Address does not need to update in order for the record value to change. The record will still point to Cloudflare, however Cloudflare will tell the domain to go elsewhere.

Note that if you're interested in using DNS for load balancing, fast failover or geo-sterring; then it's far better to use Cloudflare's dedicated product for this - Traffic Manager.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-11-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。