Gcore DNS introduces CNAME Flattening

Gcore DNS introduces CNAME Flattening

The DNS specification was developed decades ago, which means it does not reflect the needs of modern network scenarios.

For example, suppose you use a website builder that creates a unique subdomain (example.sitebuilder.com) for your entity. In that case, if you want to connect your custom domain (example.com), you need to use an A (or AAAA) record type in your DNS service and point it to the given IP address. This is a working and standardized, but inflexible, solution. If the IP address of the website from the builder changes, your website will stop working unless you monitor the changes manually and adjust it accordingly.

A partial alternative to creating an A record is to use a CNAME record. CNAME (Canonical Name) records are typically used to map a subdomain, such as “www”, to the domain hosting that subdomain’s content. You can also use it to map subdomains to other services.

However, according to the DNS spec (RFC-1034), there is a limitation in relation to CNAME: you cannot create a CNAME record for the root (apex) domain because other records (NS, SOA) exist at this node. This means that you are unable to create a CNAME record for your domain (example.com) that will point to the constructor subdomain (example.sitebuilder.com). It could work only for subdomains like www.example.com or blog.example.com.

TypeNameContentTTL
CNAMEblog.example.comexample.comAuto
Table 1. Traditional way of using CNAME record

A few years ago, we implemented support for creating a CNAME at the domain root, despite the limitation of standards. But violating the standards could cause issues with resolving. To mitigate those risks and speed up the resolving chain, we’ve introduced the CNAME Flattening feature.

The Gcore DNS CNAME Flattening mechanism allows you to use CNAME record type at the domain root and reply with the host IP due to the lookup process without violating the DNS spec.

TypeNameContentTTL
CNAMEexample.comexample.sitebuilder.comAuto
Table 2. CNAME record with CNAME Flattening

The feature gives you more flexibility to host your services in the current cloud-native environment. Moreover, to perform CNAME Flattening, our service plays the role of an “internal” DNS cache that resolves the CNAME chain and returns the host IP address. In some cases, it could reduce the time spent on the DNS lookup process and, in turn, increase the speed of your application.

To apply flattened CNAME, you need to replace a former A record for the domain root with it.

TypeNameContentTTL
Aexample.com95.85.95.85Auto
Table 3. Remove A record before CNAME Flattening is applied

Besides removing the A record, ensure there is only one record in the CNAME record set for apex so flattening works as expected. No CNAME flattening will happen if there is more than one record in this record set.

Gcore DNS introduces CNAME Flattening

Subscribe
to our newsletter

Get the latest industry trends, exclusive insights, and Gcore
updates delivered straight to your inbox.