CNAME records cannot coexist with other record types (such as MX or TXT) on the same domain. CNAME flattening resolves this by returning the target domain's IP address directly, reducing recursive DNS queries and speeding up resolution.
Benefits
CNAME flattening speeds up DNS resolution and reduces client wait times:
-
Fewer DNS queries: Returns the final IP address directly in one query instead of multiple recursive queries.
-
Faster response: Fewer queries mean lower overall resolution latency.
-
Resolves record conflicts: Converts CNAME records to A/AAAA records, allowing other record types for the same domain.
Use cases
-
Use CNAME with other record types: If a domain needs both a CNAME record and other types such as MX or TXT, enable CNAME flattening to convert the CNAME to A/AAAA records and avoid conflicts.
-
Optimize DNS queries: CNAME records can trigger multiple recursive queries, increasing latency. CNAME flattening returns the target IP address directly, reducing unnecessary queries.
How it works
When CNAME flattening is enabled and a local DNS queries the A/AAAA record of www.example.com, ESA recursively resolves the CNAME to its final IP address and returns it directly instead of the CNAME record.
Set up CNAME flattening
CNAME flattening applies only to records with a proxy status of DNS only. Records with proxy acceleration enabled are excluded to prevent exposing the origin IP address.
-
In the ESA console, select Websites. In the Website column, click the target site.
-
In the navigation pane on the left, select .
-
In the CNAME Flattening area, click Configure and select one of the following options:
-
Flatten CNAME at Root Domain: Flattens only the CNAME records for the root domain (for example,
example.com). -
Flatten All CNAMEs: Flattens the CNAME records for all subdomains.

-
-
Click OK. CNAME records are then flattened based on your configuration.
Verify the results
Example: A host record is added as follows:
api.example.com CNAME esa.example.icu

Flattening effect
|
Before CNAME Flattening is enabled, a CNAME record is returned.
|
After you enable CNAME Flattening, IP addresses are returned directly.
|

