Due to limitations in the DNS protocol, CNAME records cannot coexist with other record types, such as MX or TXT records, for the same domain name. CNAME flattening resolves this conflict by returning the IP address of the target domain instead of its CNAME record. This feature reduces the number of recursive queries from local DNS servers, which accelerates domain name resolution for clients.
Why use CNAME flattening
CNAME flattening improves DNS resolution speed and reduces client wait times.
Fewer DNS queries: Without CNAME flattening, multiple queries are required. With CNAME flattening, only one query is needed to obtain the final IP address.
Faster response: Fewer queries result in faster overall resolution speed.
Resolves record conflicts: CNAME flattening converts CNAME records to A/AAAA records. This process avoids conflicts and lets you use other record types for the same domain name.
Use cases
Use CNAME with other record types: If a domain requires both a CNAME record and other record types, such as MX or TXT, you can use CNAME flattening to convert the CNAME record to an A/AAAA record. This avoids conflicts.
Optimize DNS queries: CNAME records can cause multiple recursive queries, which increases latency. You can use CNAME flattening to obtain the target domain's IP address directly. This reduces unnecessary queries and improves resolution speed.
How it works
With CNAME flattening enabled, when a Local DNS queries for the A/AAAA record of www.example.com, ESA performs a recursive query to retrieve the IP address that corresponds to the CNAME record. The IP address is then returned directly to the Local DNS instead of the CNAME record.
Set up CNAME flattening
The CNAME flattening feature applies only to records with a proxy status of DNS only. If proxy acceleration is enabled for a record, CNAME flattening is not applied. This prevents the origin IP address from being exposed.
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. The system then flattens the CNAME records 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.
|

