CNAME flattening is a DNS resolution technology that allows you to use CNAME records instead of A/AAAA records at root domains such as example.com
. In most cases, CNAME records at root domains are not allowed. However, with CNAME flattening, ESA finds the IP address that a CNAME points to and then returns the final IP address to clients.
Prerequisites
CNAME flattening only applies to DNS records with a Proxy Status of "DNS Only." It does not take effect for records with a Proxy Status of "Proxied", as CNAME flattening for proxied records would expose your origin IP address.
How it works
Without CNAME flattening
When a client sends a request to domain name
www.example.com
, the system sends a request to the local DNS server to resolve the domain namewww.example.com
.The local DNS server sends a request to the authoritative DNS server to resolve the domain name
www.example.com
.The authoritative DNS server returns the CNAME record value
www.example.com.ialicdn.com
.The local DNS server sends a request to the DNS scheduling system of ESA to resolve the domain name
www.example.com.ialicdn.com
and the scheduling system returns the IP address of the nearest point of presence (POP).The local DNS server receives the IP address of the nearest ESA POP.
The local DNS server returns the IP address of the nearest POP to the client and the client accesses the IP address.
After CNAME flattening
When a client sends a request to domain name
www.example.com
, the system sends a request to the local DNS server to resolve the domain namewww.example.com
.The local DNS server sends a request to the authoritative DNS server to resolve the domain name
www.example.com
.The authoritative DNS server returns the IP address of the nearest ESA POP.
The local DNS server returns the IP address of the nearest POP to the client and the client accesses the IP address.
Benefits
CNAME flattening can speed up DNS resolution and reduce the client waiting time.
DNS queries: After you use the CNAME flattening feature, you need to initiate only one DNS query to obtain the final IP address.
Response speed: CNAME flattening allows you to reduce the number of DNS queries and speed up DNS resolution.
Procedure
Log on to the ESA console.
On the Websites page, find the website that you want to manage, and click the website name or View Details in the Actions column.
In the left-side navigation tree, choose
.In the CNAME Flattening section, click Configure.
Valid value of CNAME Flattening
Description
Flatten CNAME at Root Domain
If you select this option, CNAME flattening applies only to the root domain
example.com
.NoteFor example, you have a root domain
example.com
and a subdomainapp.example.com
.After you set CNAME Flattening to Flatten CNAME at Root Domain, the
example.com
domain name points to another domain name such astarget.com
based on the CNAME record. The subdomainapp.example.com
is not affected and may point to another IP address or domain name.Flatten All CNAMEs
If you select this option, CNAME flattening applies to the root domain and its all subdomains. All CNAME records point to the same domain name.
NoteFor example, you have a root domain
example.com
and a subdomainapp.example.com
.After you set CNAME Flattening to Flatten All CNAMEs, the root domain
example.com
and subdomainapp.example.com
automatically point totarget.com
. In the meantime, all custom subdomains such asshop.example.com
andblog.example.com
also point totarget.com
.Click OK.