API
The Gcore Customer Portal is being updated. Screenshots may not show the current version.
Managed DNS
Managed DNS
Chosen image
Home/Managed DNS/Records/CNAME flattening

Create records in zone apex (CNAME flattening)

What is the challenge with the creation of records in the root zone (zone apex)?

CNAME records are increasingly used to integrate domains with third-party solutions such as CDNs. Using an A record, which specifies the concrete IP address that resolves the domain, may not be suitable in cases where IP addresses change frequently based on the geolocation of requests.

According to the RFC 1034 specification, a CNAME record cannot coexist with other records. Therefore, it is impossible to specify a CNAME record for the root domain, also known as the "apex domain" (e.g., sample-test.com), because it has mandatory NS and SOA records.

While using a subdomain (e.g., cdn.sample-test.com) for CNAME record creation can be sufficient, some website owners may want to integrate their root domain. For this situation, Gcore Managed DNS provides the CNAME flattening feature.

How does CNAME flattening work?

CNAME flattening is a mechanism that allows specification restrictions to be bypassed, enabling a CNAME to be specified for the root domain. It resolves the CNAME chain and uses the IP address of the final A or AAAA record. This synthetic record is then cached, respecting its TTL, and used to answer subsequent DNS queries for the apex domain on the Gcore DNS side.

By using CNAME flattening, we avoid specification violations and ensure proper DNS resolution in more cases. Due to the local cache layer, the total resolution time may significantly decrease, improving performance.

Configuration of CNAME flattening

Gcore Managed DNS provides CNAME flattening to customers on all plans by default. To use this feature, you must:

1. Remove the A record for the root domain before creating the CNAME record.

Delete an A record

2. Ensure that there is only one CNAME record to ensure that flattening works as expected.

Ada a CNAME record to apex zone

You can check the CNAME record's value using the Gcore DNS Lookup tool.

Was this article helpful?

Not a Gcore user yet?

Learn more about our DNS hosting

Go to the product page
// // Initialize a variable to undefined initially. // var growthBook = undefined; // (function() { // try { // var script = document.createElement('script'); // script.src = "https://cdn.jsdelivr.net/npm/@growthbook/growthbook/dist/bundles/auto.min.js"; // script.setAttribute("data-api-host", "https://cdn.growthbook.io"); // script.setAttribute("data-client-key", "sdk-truekA5wvhMYaqsu"); // document.head.appendChild(script); // script.onload = function() { // console.log("GrowthBook script loaded successfully."); // growthBook = window.GrowthBook; // Assuming GrowthBook attaches itself to window // }; // script.onerror = function() { // console.error("Failed to load the GrowthBook script."); // growthBook = undefined; // Explicitly set to undefined on error // }; // } catch (error) { // console.error("An error occurred while setting up the GrowthBook script:", error); // growthBook = undefined; // } // })(); // // Optional: Push to dataLayer if needed // window.dataLayer = window.dataLayer || []; // window.dataLayer.push({ // 'event': 'scriptLoadStatus', // 'growthBookStatus': growthBook ? "Loaded" : "Failed" // });