CNAME records cannot coexist with other record types (such as MX or TXT) under the same domain name due to DNS protocol limitations. CNAME flattening resolves these conflicts by mapping CNAME records to their IP addresses and returning the IP address of the target domain instead of its CNAME record. This feature also reduces recursive queries by local DNS, speeding up domain name resolution for clients.
Why use it
CNAME flattening speeds up DNS resolution and reduces client waiting time.
Fewer DNS queries: Before CNAME flattening, multiple queries are needed; after flattening, it takes only one query to retrieve the final IP address.
Faster response: With fewer queries, the overall resolution speed improves.
Coexistence with other record types: CNAME flattening converts CNAME records to A/AAAA records, avoiding conflicts and preserving other record types.
When to use
Using CNAME with other record types: If a domain needs both CNAME and other record types (like MX or TXT), CNAME flattening can convert CNAME records to A/AAAA records to avoid conflicts.
Optimizing DNS queries: CNAME records lead to multiple recursive queries, which increases latency. CNAME flattening allows direct access to the target domain's IP address, reducing unnecessary queries and improving resolution speed.
How it works
As shown in the following figure, after CNAME flattening, ESA retrieves the IP address for the CNAME record through recursive queries. It then returns this IP address directly to local DNS, instead of returning the CNAME record value for www.example.com
.
Set up CNAME flattening
The CNAME flattening feature is only applicable to records with proxy status set to DNS Only. When proxy is enabled for a record, CNAME flattening will not take effect to protect the origin IP address.
In the ESA console, choose Websites , find the website you want to manage and click .
In the left-side navigation pane, choose .
Click Configure in the CNAME Flattening area, select either Flatten CNAME at Root Domain or Flatten All CNAMEs according to your needs.
Flatten CNAME at Root Domain: Only flattens CNAME records in the primary domain name (such as
example.com
).Flatten all CNAMEs: Flattens CNAME records in all domain names.
Click OK, and ESA will flatten CNAME records according to your configuration.