A customer wants example.com to point at a CDN. CNAME at the apex isn’t legal. The team’s options: hand-resolve the CDN’s IPs into the cPanel zone (and refresh when they change), move the apex to a DNS provider that does flattening (Cloudflare, Route 53), or redirect-from-apex. Each has trade-offs. CNAME flattening is the cleanest for a static CDN target, but it requires moving the zone away from cPanel’s nameservers.
What’s happening
CNAME flattening — also called ALIAS or ANAME records on different providers — is a vendor-extension feature. The provider’s nameserver receives a query for the apex (example.com A), looks up the CNAME target (cdn.provider.net) internally, returns the resolved A/AAAA to the client. From the client’s view, the apex has a normal A record. From the operator’s view, the apex’s configuration is a single CNAME entry that the provider keeps fresh.
Providers that support this:
- Cloudflare — CNAME flattening for any apex, with their DNS.
- AWS Route 53 — ALIAS records for AWS-hosted targets (ELB, CloudFront, S3, API Gateway), with first-party knowledge of the target.
- DNSimple, DNS Made Easy, several others — ANAME or ALIAS records.
cPanel’s BIND has no flattening. To use flattening, you delegate the zone (or specific subdomains) to a flattening-capable provider.
The trade-off:
- Pro: the apex looks like a CNAME to the operator (simple); the resolver gets a normal A (compliant); the provider keeps it fresh (low operational cost).
- Con: zone management splits between the flattening provider and cPanel. If the customer’s mail is on cPanel, the MX records still live in cPanel’s zone — unless you move every record to the flattening provider.
- Con: DNSSEC support varies. Cloudflare supports DNSSEC; Route 53 does. If you depend on DNSSEC, confirm the provider signs the zone they host.
How to verify
Confirm the apex’s published record from the client’s perspective:
dig +short example.com A
dig +short example.com CNAME
A flattened apex returns A records via dig even though configured as a CNAME at the provider. No CNAME shows for the apex (dig CNAME returns empty), but A returns whatever the CDN currently uses.
For Cloudflare specifically:
dig NS example.com @1.1.1.1
If the NS records point at *.ns.cloudflare.com, the zone is at Cloudflare. Their dashboard then shows the flattened CNAME at the apex.
What to do
Decide whether to move the whole zone or only the apex’s parent.
Option A: move the whole zone to a flattening provider.
- Export the zone from cPanel as a BIND-format file:
whmapi1 dumpzone domain=example.com --output=jsonpretty | jq -r '.data.zone[].record[] | "\(.name) \(.ttl // 14400) \(.type) \(.record)"' > /tmp/example.com.zone.txt
- Import into the flattening provider. Cloudflare’s dashboard has a “Import DNS records” feature; Route 53 takes BIND-format imports.
- Change the NS at the registrar to the new provider’s nameservers.
- Configure the apex as a CNAME-equivalent (ALIAS in Route 53, CNAME flattening in Cloudflare’s UI).
- Update cPanel to know the zone is no longer locally authoritative. Remove the local zone or set it to “Skipped” in WHM > DNS Functions.
Option B: keep most records on cPanel, delegate only the parts needing flattening.
This is messier and rarely justifies the complexity, but possible. The cPanel zone delegates app.example.com (with NS records at that subdomain) to the third-party provider. Apex stays at cPanel; the subdomain that needs flattening lives elsewhere.
Option C: hand-resolve and refresh.
If you can’t move the zone, run a cron that resolves the CDN target periodically and updates the apex A record via whmapi1. See the alias-aname-no-native article for the script.
Whichever option, lower the apex TTL to 300 during the migration so users see the new resolution quickly. Raise back to 3600 once stable.
If you’re using cPanel’s AutoSSL and you move the apex to a third-party provider, the HTTP-01 challenge at the apex still works (the cert is for the apex hostname; HTTP-01 reaches via the resolved A record). But if AutoSSL needs DNS-01 (wildcard certs, restricted CAA), you’ll need the third-party provider’s API for AutoSSL to publish the TXT record.
Stack Harbor evaluates flattening-vs-redirect-vs-script as part of CDN integration in deployment management.