A few years ago, we introduced a new record type called ANAME records which give you the functionality of a CNAME record, but at the root level (also known as CNAME flattening). If you’re unfamiliar with these record types, here’s a crash course in DNS record types:
An A record points a domain to an IP address (like 127.00.38.402), while a CNAME record points a domain to a hostname (like example.com).
If you want to add a CDN (Content Delivery Network) to your domain, you need to create a CNAME record that points to the hostname of your CDN provider. The CDN then decides which web server (or IP address) to point the user to based on their location.
The problem is, CNAME records cannot be used at the root level. That means you wouldn’t be able to point example.com (rather than www.example.com) to a hostname.
What’s so special about pointing from the root level? This is a new trend some are calling “naked domains”. Frankly, domains look sexier without the often overlooked www. in front of it. It’s also how we speak. No one says,
“Hey Frank, go to www.constellix.com”.
To bypass this, people had to point their CDN’s to the www. version of their site and then redirect users to the naked domain. Redirects can be costly, time-wise. Even worse if you already have other redirects or a redirect from HTTP to HTTPS. Altogether, these redirects could cost you an entire second or more.
So we re-engineered the CNAME record from scratch and created ANAME records.
Not only do ANAME records improve site load time, but they are good for SEO (Search Engine Optimization, AKA: rank higher on Google). The faster your site loads and the fewer redirects required to reach a page have been shown to improve SEO.
ANAME + CDN
Let’s see this in action! The diagram below shows an ANAME record pointing a naked domain to a CDN… all without redirects.
In this example, the domain we are looking for is using an ANAME record to point traffic to their CDN at hostname.com. Then, the CDN will point the user to the closest copy of the website which is hosted on a web server at 127.4.3.66.
If you want to try this out for yourself, check out the ANAME tutorial on our help site.
Also published on Medium.