1
0
mirror of https://github.com/jbranchaud/til synced 2026-07-03 08:08:24 +00:00
Files
til/devops/cloudflare-allows-cname-for-apex-domain.md
T

1.0 KiB

Cloudflare Allows CNAME For Apex Domain

If you want to set up a custom root (apex) domain with an app hosting provider like Heroku, you're going to need to work with a DNS provider that supports the non-standard ALIAS records (or something equivalent).

In my case, I have my domain registered with Cloudflare. Cloudflare supports this kind of CNAME lookup of an apex domain through CNAME flattening.

Unlike other registrars that use a separate ALIAS record concept, Cloudflare allows you to set up a specialized CNAME record. Go into the DNS settings for the domain of interest, click "Add Record", and then select CNAME. From there, instead of entering a traditional subdomain like www, you put the @ symbol which tells Cloudflare that this is a record for the apex domain. That record will still point to a target like abc123.herokudns.com as a more traditional CANME would do.