CNAME
A DNS record type that maps one domain name to another (an alias). CDNs use CNAMEs to route traffic through their network—you point your subdomain to the CDN's hostname.
Full Explanation
CNAME stands for Canonical Name. It's how you tell DNS "when someone asks for www.example.com, actually look up cdn-123.cdnprovider.net instead." The CDN provider's DNS then resolves to the optimal edge IP for that user.
The big limitation: you can't put a CNAME at the zone apex (example.com without www). DNS standards forbid it because a CNAME can't coexist with other record types, and the apex always has SOA and NS records. Workarounds include ALIAS/ANAME records (provider-specific) or CDNs that use A records with Anycast.
When switching CDNs, the CNAME is usually all you need to change. Point it to the new CDN's hostname, and traffic shifts. TTL on your CNAME record determines how fast that switch happens.
Examples
# Typical CDN CNAME setup
# In your DNS zone file:
www.example.com. 300 IN CNAME d1234.cloudfront.net.
cdn.example.com. 300 IN CNAME cdn.example.com.c.footprint.net.
# Verify the CNAME chain
$ dig +trace www.example.com
www.example.com. 300 IN CNAME d1234.cloudfront.net.
d1234.cloudfront.net. 60 IN A 54.230.1.100
# For zone apex, use provider-specific solutions:
# Cloudflare: CNAME flattening (automatic)
# Route53: ALIAS record
# DNSimple: ALIAS record
Video Explanation
Frequently Asked Questions
A DNS record type that maps one domain name to another (an alias). CDNs use CNAMEs to route traffic through their network—you point your subdomain to the CDN's hostname.
# Typical CDN CNAME setup
# In your DNS zone file:
www.example.com. 300 IN CNAME d1234.cloudfront.net.
cdn.example.com. 300 IN CNAME cdn.example.com.c.footprint.net.
# Verify the CNAME chain
$ dig +trace www.example.com
www.example.com. 300 IN CNAME d1234.cloudfront.net.
d1234.cloudfront.net. 60 IN A 54.230.1.100
# For zone apex, use provider-specific solutions:
# Cloudflare: CNAME flattening (automatic)
# Route53: ALIAS record
# DNSimple: ALIAS record
Related CDN concepts include:
- Zone Apex — The root of a DNS zone, also called the "naked domain" or "apex domain." For …