Summary

CNAME records create DNS aliases but cannot be placed at your root domain because the DNS spec (RFC 1034) forbids them from coexisting with the SOA and NS records every domain requires — and attempting it also breaks email. name.com's ANAME record solves this by resolving your target hostname at the nameserver level and serving a standard A record, giving you automatic IP updates without violating DNS rules. This guide covers how CNAME records work, when to use ANAME instead, and the most common conflicts (MX records, TXT verification, CNAME loops) before they break production.

You're setting up your new blog on Heroku. Their docs tell you to add a CNAME record pointing to your-app.herokuapp.com. You open your DNS panel, create www.yourdomain.com as a CNAME, and it works perfectly.

Then you try to point the root domain (yourdomain.com) at the same target and hit an error: “CNAME records cannot be created for the root domain.”

This isn’t a Heroku limitation, and it isn’t a bug in your DNS provider. It’s a rule baked into the DNS specification itself: a CNAME record cannot coexist with other records at the zone apex. Since the root of your domain must contain records like SOA and NS, a standard CNAME simply isn’t allowed there.

Modern DNS providers work around this with features like ALIAS, ANAME, or CNAME flattening. Platforms like Heroku also document how to configure a root domain correctly using these mechanisms.

The underlying rule, however, still matters. To understand why this restriction exists — and when it can cause subtle production issues — you need to understand how CNAMEs actually work.

What is a CNAME? (The Mechanics)

A CNAME (Canonical Name) record creates an alias. It tells DNS, "Don't answer this query. Go ask about this other hostname instead."

Here's what happens when someone visits blog.example.com with a CNAME pointing to app-123.platform.com:

  1. Browser asks DNS: "What's the IP for blog.example.com?"
  2. DNS responds: "I don't have an IP. Go look up app-123.platform.com instead."
  3. Browser asks DNS again: "What's the IP for app-123.platform.com?"
  4. DNS responds: "That's 203.0.113.45."
  5. Browser connects to 203.0.113.45.

You can see this in action with the dig command:

Bash
dig www.microsoft.com

…
;; ANSWER SECTION:
www.microsoft.com.	2440	IN	CNAME	www.microsoft.com-c-3.edgekey.net.
www.microsoft.com-c-3.edgekey.net. 187 IN CNAME	www.microsoft.com-c-3.edgekey.net.globalredir.akadns.net.
www.microsoft.com-c-3.edgekey.net.globalredir.akadns.net. 187 IN CNAME e13678.dscb.akamaiedge.net.
e13678.dscb.akamaiedge.net. 13	IN	A	2.22.197.228

The DNS response includes both the CNAME record and the final A record. But notice that multiple lookups happened. Every CNAME adds latency because it requires a second or a third query. For users on slow connections or far from your nameservers, this matters.

Why use a CNAME at all? Because cloud platforms can change IPs without warning. When Heroku shifts your app to a new server, app-123.herokuapp.com automatically resolves to the new IP. Your CNAME keeps working. An A record would break until you manually updated it.

The trade-off is speed versus flexibility. CNAMEs give you automatic updates but cost you an extra DNS lookup on every visit. Understanding the difference between these DNS record types helps you make this decision correctly for your infrastructure.

The "Zone Apex" Problem (The Root Domain)

If a DNS name has a CNAME record, it must not have any other record types associated with it.

This behavior is defined in the original DNS specifications, particularly RFC 1034, which describes how CNAME records work and how resolvers process them. Operational guidance is made explicit in RFC 1912, Section 2.4, which states:

A CNAME record is not allowed to coexist with any other data.

The reason is architectural. A CNAME doesn’t contain data like an A or MX record does — it says, “this DNS name is an alias for another host.” If other records existed alongside it, resolvers would face conflicting instructions about whether to follow the alias or use the local data.

Because the zone apex must contain records like SOA and NS, placing a CNAME there would violate this rule. That’s why standard DNS forbids CNAME records at the root of a zone.

Why does this matter for your root domain? Because your root domain (example.com) requires two records to exist at all:

  1. SOA (Start of Authority): Defines who manages the zone and how often to refresh it
  2. NS (Name Server): Points to the nameservers that answer queries for your domain

These aren't optional. Without them, your domain doesn't exist on the internet. And if you try to add a CNAME to example.com, you're asking DNS to both "ignore this name and look elsewhere" (the CNAME) and "use these nameservers" (the NS records). The protocol can't do both.

This would also break email. Your root domain needs MX records to receive mail at user@example.com. Add a CNAME, and those MX records become invalid. Email stops working.

The practical impact of these restrictions hits hardest when you're deploying to platforms like Vercel, Netlify, or GitHub Pages. They give you a hostname like your-project.vercel.app and tell you to point your domain there. It works fine for www.example.com, but you can't do the same for example.com. You're forced to either:

  1. Use an A record (which breaks if they change IPs)
  2. Redirect all traffic from example.com to www.example.com (losing the clean URL)
  3. Give up on using the root domain entirely

None of these are good options.

The Solution: name.com's ANAME Record

name.com solves this with the ANAME record. It's not part of the DNS specification, it's a feature that name.com nameservers provide to work around the zone apex limitation.

Here's how it works:

  1. You create an ANAME record in the name.com dashboard pointing to your target hostname (like app.platform.com)
  2. name.com's nameservers periodically resolve that hostname to get its current IP address
  3. When a query comes in for your domain, name.com returns the IP as a standard A record
  4. To the rest of the internet, it looks like you have a normal A record, but it automatically updates when the target hostname changes IPs

From the browser's perspective, this is a single-step lookup. You get the speed of an A record with the flexibility of a CNAME.

Configuring an ANAME record:

  1. Log in to your name.com account
  2. Navigate to your domain's DNS settings
  3. Add a new record with these settings:
    • Type: ANAME
    • Host: @ (represents your root domain)
    • Answer: your-app.platform.com (your target hostname)
    • TTL: 300 (5 minutes, allowing quick updates)

4. Save the record

TYPEHOSTANSWERTTLPRIO
ANAMEdraftexample.workyour-app.platform.com300N/A

The record goes live within minutes. name.com handles the resolution in the background, checking for IP changes at regular intervals and updating the served A record automatically. Understanding domain propagation helps you know when your changes will be visible globally.

The key benefit: You can now point your root domain to a hostname that might change IPs, without violating DNS protocol rules or breaking your email. Your SOA and NS records stay in place, your MX records keep working, and your users can access your site at example.com without the www. Learn more about bare CNAME records and how name.com handles them.

This is the same concept that Cloudflare calls "CNAME Flattening" and that AWS Route53 calls an "Alias" record. The implementation differs slightly, but the goal is identical: solve the zone apex CNAME problem.

Common Pitfalls and Conflicts

Even when you're using CNAMEs correctly on subdomains, several edge cases can break your setup.

MX Records and Wildcard CNAMEs

A common concern is whether a wildcard CNAME conflicts with your email configuration.

Consider:

*.example.com.    300    IN    CNAME    your-app.platform.com.
mail.example.com. 300    IN    MX       10 mail-server.com.

This configuration is valid.

The CNAME exclusivity rule applies per name, not per wildcard scope. *.example.com and mail.example.com are different owner names in the zone. According to RFC 4592, a wildcard record is only used when no explicit record exists for the queried name.

Because mail.example.com has its own MX record, the wildcard CNAME does not apply to it.

However, problems occur if you try to attach a CNAME and another record to the same name:

mail.example.com. 300 IN CNAME app.platform.com.
mail.example.com. 300 IN MX    10 mail-server.com.

This is invalid. A name with a CNAME must not have any other records.

Additionally, remember that the host specified in an MX record must finally resolve to an A or AAAA record. If mail.example.com is listed as an MX target, it must have an address record of its own.

TXT Record Conflicts

You cannot add a TXT record to a name that already has a CNAME. The CNAME exclusivity rule applies to all record types.

This is invalid:

# This is invalid:
app.example.com.    300    IN    CNAME    platform.com.
app.example.com.    300    IN    TXT      "verification-code-123"

This often causes issues when a service asks you to verify domain ownership by adding a TXT record to a subdomain that already points to a platform via CNAME.

Because a CNAME must be the only record at that name, the DNS provider will reject the TXT record.

  • Common workarounds include:
  • Verifying the root domain (example.com) instead
  • Using a provider-specific verification name like _verification.example.com
  • Verifying a different subdomain that is not aliased with a CNAME

The key rule is simple: if a name is a CNAME, it cannot hold any TXT records at the same label.

CNAME Loops

If you create a circular reference, DNS queries fail:

# This creates an infinite loop:
a.example.com.    300    IN    CNAME    b.example.com.
b.example.com.    300    IN    CNAME    a.example.com.

When a resolver tries to look up a.example.com, it follows the CNAME to b.example.com, which points back to a.example.com. Most resolvers detect this after a few iterations and return an error. The site becomes unreachable.

This seems obvious in a two-record example, but it happens accidentally in complex setups where subdomains point to other subdomains across different zones. Always trace the full chain before deploying changes. Use troubleshooting tools for DNS connectivity to verify your configuration.

Multiple CNAME Chains

While not technically invalid, long CNAME chains hurt performance:

# Each step adds latency:
app.example.com. 300 IN CNAME lb.platform.com.
lb.platform.com. 300 IN CNAME region-us.platform.com.
region-us.platform.com. 300 IN A 203.0.113.45

That's three DNS lookups instead of one. Each lookup might take 50-100ms depending on network conditions. For users on mobile networks or in regions far from your nameservers, this adds up. Keep CNAME chains as short as possible.

ScenarioRecord TypeExample
Subdomain pointing to IP addressA Recordblog.example.com → 203.0.113.45
Subdomain pointing to hostnameCNAMEblog.example.com → app.platform.com
Root domain pointing to IP addressA Recordexample.com → 203.0.113.45
Root domain pointing to hostnameANAMEexample.com → app.platform.com
IPv6 addressAAAA Recordexample.com → 2001:0db8::1
Email serverMX Recordexample.com → mail.example.com
Domain verificationTXT Recordexample.com → "verification-code"

A quick verification checklist:

  • If the record is for your root domain and needs to point to a hostname, use an ANAME
  • If the record is for a subdomain that also needs MX or TXT records, use an A record instead of a CNAME
  • If you're configuring a wildcard catch-all, make sure it doesn't conflict with specific subdomains you need for email or verification
  • If your platform (Heroku, Vercel, Netlify) provides both a hostname and IP addresses, prefer the hostname with an ANAME or CNAME so you get automatic updates

The most common mistake is trying to use a CNAME at the root domain. The second most common is using a CNAME on a subdomain that needs to receive email. Both are prevented by the same RFC 1034 rule: CNAMEs must be the only record for that name.

For developers automating DNS management, the name.com API provides programmatic access to create DNS records, update records, and list all records for your domains.

Get Your DNS Right the First Time

CNAMEs follow strict protocol-level rules that made sense in 1987 but cause confusion today. The zone apex restriction exists because your root domain requires SOA and NS records to function, and CNAMEs can't coexist with other records.

name.com's ANAME records solve this by handling the resolution on name.com's nameservers and serving the result as a standard A record. You get automatic IP updates when your platform changes infrastructure, without violating DNS protocol rules or creating conflicts with your MX and NS records.

Deploy your root domain to your favorite cloud platform without fighting against the DNS protocol. Use name.com's ANAME records to point example.com to any hostname, and skip the workarounds. Start managing your domains with name.com.

Next steps

Now that you understand CNAME records and zone apex limitations, here are recommended resources to enhance your DNS management:

Automate DNS with the name.com API: If you're managing multiple domains or need to programmatically update DNS records, explore the name.com API documentation. The API lets you create, update, and delete DNS records without manual dashboard access, perfect for CI/CD pipelines and infrastructure-as-code deployments.

Secure your DNS with DNSSEC: Protect your domain from DNS spoofing and cache poisoning attacks by enabling DNSSEC. This cryptographically signs your DNS records, ensuring users always reach your legitimate servers. Review the DNSSEC FAQ for implementation guidance.

Configure advanced DNS features: Explore Dynamic DNS records for servers with changing IPs, CAA records to control which certificate authorities can issue SSL certificates for your domain, and URL forwarding for redirecting visitors to new locations.

Optimize your nameserver configuration: Learn about changing nameservers for DNS management, registering custom nameservers, and viewing your domain nameservers to fully control your DNS infrastructure.

CNAME FAQs

Can I use a CNAME record for my root domain (example.com)?

No. The DNS specification (RFC 1034) forbids CNAME records at the zone apex because the root domain must have SOA and NS records, and a CNAME cannot coexist with any other record type at the same name. Use name.com's ANAME record instead — it behaves like a CNAME but resolves at the nameserver level, so the rest of the internet sees a standard A record.

What's the difference between a CNAME and an ANAME record?

A CNAME is a DNS alias that redirects resolution to another hostname — the resolver follows the chain until it reaches an A record. An ANAME is a name.com-specific feature that does the same resolution work on name.com's nameservers and returns the resulting IP as a standard A record. The key difference: ANAME works at the root domain, CNAME does not. Both give you automatic IP updates when your platform's infrastructure changes.

Why does adding a CNAME break my email?

A CNAME must be the only record for its name — it cannot coexist with MX, TXT, or any other record type. If you add a CNAME to a name that has MX records (or try to add MX records to a name with a CNAME), the DNS provider will reject the configuration or your email will stop working. If you need a subdomain to handle both web traffic and email routing, use an A record instead of a CNAME.

How do I add a TXT verification record to a subdomain that already has a CNAME?

You can't — a name with a CNAME cannot hold any other record type. Your options are: verify at the root domain (example.com) instead, use a provider-specific verification label like _verification.example.com, or verify at a different subdomain that isn't aliased with a CNAME. Check whether your service supports any of these alternatives before reconfiguring your DNS.

Does a wildcard CNAME (*.example.com) conflict with my MX records?

No, as long as your MX records are defined explicitly. A wildcard record only applies when no specific record exists for the queried name (RFC 4592). Because mail.example.com with its own MX record is a different owner name than *.example.com, the wildcard CNAME doesn't apply to it. The conflict only occurs if you try to attach a CNAME and another record to the exact same name — for example, adding both a CNAME and an MX to mail.example.com.