DNS – Is Using @ CNAME for Root Domain Reliable?

cname-recorddomain-name-system

Due to a gap in my knowledge I set up a Windows VM on Azure then I went to Namecheap and registered a domain. Somewhere I got the idea to put in a CNAME record against @ and the FQDN and it works.

In my name records there are literally 2 entries @ and www for CNAME against the Azure VM FQDN. Everything works sweetly.

Yesterday, the guy I'm doing work for went to switch over the name servers on the planned domain which was not at Namecheap (I was using a dummy domain I registered at Namecheap) and couldn't do what I did, and we spent a few hours looking into it.

Today, I used a tool to look up the site and it appears that Namecheap uses the domain I provided to lookup the IP address and enters an A record against that IP, but it doesn't appear on the management page. So it's done in the background. Yesterday I reset the VM and the IP changed and the domain was back up in a couple of minutes.

How normal is this? How stable is this? I don't have a dedicated IP on Azure.

I now understand that @ on non-www domain is not normal (i.e. can't typically place @ against a CNAME record). But are there reputable domain hosts that are providing this service for free? Is it something I can search for? (Secondary problem is Namecheap is currently not willing to take on transfer of a this domain because apparently .com.au domains are tricky to transfer).

If this is rare, are my only options paying Azure for a static IP and using A records?

Best Answer

CNAMEs at the root aren't really supported by any standard, but some providers does it since it's quite handy. The problem, as you've noticed, is that since it's not a standardised solution, the implementations vary, like for example querying the name in the CNAME, resolving it and inserting the IP as an A-record.

I wouldn't recommend this practice, since there's actual reasons for why the root record needs to be an A or AAAA record.

The proper ways to handle this is either to pony up and pay for a static IP from Azure, or alternatively, if you were hosting a lot of these sites, is to get a single static IP for a load balancer/reverse proxy, and let it forward requests to your dynamic web applications.

Or, you could use Cloudflare, since they've actually managed to make an RFC-compliant CNAME at root implementation. https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/

Related Topic