What is an ALIAS Record?
An ALIAS record (also known as an ANAME record) is a virtual record type that provides CNAME-like functionality where CNAME records are not allowed by DNS standards-specifically at the root (apex) of a domain. It's not a true DNS record, but rather a feature provided by many modern DNS hosting services.
Why Do We Need ALIAS?
DNS RFCs state that a CNAME record cannot coexist with any other record for the same name. Since the root domain (e.g., mysite.com) must have SOA and NS records, you cannot put a CNAME there. ALIAS records solve this problem.
How It Works
When you create an ALIAS record, your DNS provider doesn't actually publish a record called "ALIAS". Instead, their nameservers perform a server-side lookup of the target domain and return the resulting A or AAAA record directly to the user.
- User requests
example.com. - Your nameserver sees an ALIAS record pointing to
myapp.herokuapp.com. - The nameserver resolves
myapp.herokuapp.comto1.2.3.4. - The nameserver returns
example.com A 1.2.3.4to the user.
ALIAS vs. CNAME
- CNAME: Returns the target domain name to the user. The user's browser must then perform a second lookup. Cannot be used at the root.
- ALIAS: Returns the IP address of the target directly. Can be used anywhere, including the root domain.
Common Use Case: Root Domain on Cloud Hosting
If you're using a service like a Load Balancer (AWS ELB), a CDN, or a PaaS (Heroku, Netlify), they often provide a long hostname rather than a static IP. To point your root domain to these services, you must use an ALIAS record if you want it to work correctly.