Working as a cloud engineer you may ask yourself, is it possible to create a CNAME record for your root domain? The answer will be no for most of the hosting providers but that’s not the case for Cloudflare. Cloudflare figured out that working on cloud, you don’t get static IPs especially if your app is deployed on some of the container orchestration services where you are working with load balancers. They finally manage to “hack” the DNS and announce the CNAME Flattening: RFC-Compliant CNAMEs at a Domain’s Root. In this tutorial I will show you how to achieve this.
- Cloudflare account
Step 1. Point your DNS Nameservers to Cloudflare Nameservers. You can find them in the DNS Cloudlfare section.
Step 2. Once your Nameservers are pointed to CLoudflare ones and propagated, you should be able to create a CNAME for your root domain.
Step 2. To create CNAME for your root domain follow the order:
- Go to DNS Account Section
- Click on the
- From the dropdown menu choose
- In the
Namefield put your root domain. For example
- In the
Targetfield put the alias name. For example I want to point my domain
devcoops.comto point to AWS ALB internal load balancer:
`Type` `Name` `Content` `TTL` `Proxy status` CNAME devcoops.com proxy-internal-alb.devcoops.com Auto DNS only
If you followed the steps above you can easily create CNAME for your own root domain. For any additional questions regarding this please put a comment below. If you find this tutorial useful share it with the rest of the tech community and follow our official channel on Telegram.