Cloudflare Docs
DNS
DNS
Edit this page
Give us feedback
Set theme to dark (⇧+D)

How CNAME flattening works

With CNAME flattening, Cloudflare returns an IP address instead of the target hostname that a CNAME record points to. This process supports a few features and delivers better performance and flexibility, as mentioned in the CNAME flattening concept page.

Consider the diagram below to have an overview of the steps that may be involved in CNAME flattening.

​​ Example use case

  • domain.test is a zone on Cloudflare and has the following CNAME record:
TypeNameContentTTL
CNAMEdomain.testexternal-origin.test3600
  • external-origin.test is a zone on a different DNS provider and has the following A record:
TypeNameContentTTL
Aexternal-origin.test192.0.2.17200

In this case, the process to respond to queries for domain.test directly with the IP address can be represented by the following diagram:

​​ Aspects to consider

  • If the CNAME record is proxied in Cloudflare, the answer is made up of multiple Cloudflare IPs and its Time to Live (TTL) is set to 300.
  • If the CNAME record in Cloudflare is not proxied, the flattened answer consists of the IP address from the external DNS provider and its TTL corresponds to the lower value between the external record and the Cloudflare CNAME record.