Working Around the Apex CNAME Constraint with HTTPS Records

A story of oversight, misuse, and redemption.

CNAME (Canonical Name) DNS records allow rewriting one name in a zone to another name, be it in the same zone or elsewhere. Take this record for example:

www.mydomain.example. 300 IN CNAME mydomain.hostingprovider.example.

When a recursive DNS resolver receives a query for www.mydomain.example, it receives the CNAME response, queries the target name, and returns the final answer to the client.

A common misconception is that the target name is an alias for the left-hand side (the owner name) while in reality the owner name is an alias for the target, effectively providing DNS zones with an “also known as” semantic. Every alias leads back to the canonical name, which is where the record type gets its name.

A CNAME record essentially tells the resolver to continue the lookup at the target name. The zone apex needs NS and SOA records and CNAME simply can’t coexist with any other DNS records (except DNSSEC signatures) at the same name.

Unlike email, which was given MX records from early on, the early web didn’t have a dedicated record type, an oversight prompting engineers to improvise. Using a CNAME on the www prefix for aliasing to a hosting provider became a common practice.

Although this setup worked reliably, the desire to have the website accessible by the apex domain name and dropping the www prefix remained. That gave rise to pseudo-records such as ALIAS or ANAME, as well as proprietary features like CNAME flattening. They all essentially work the same way, the authoritative nameserver resolves the target and synthesise the A/AAAA record for the client before responding.

HTTPS AliasMode: The Web’s MX Moment

With the introduction of HTTPS, the web finally got its MX equivalent. HTTPS records tell clients how to connect to an HTTPS service. It operates in two modes, AliasMode (Priority 0) and ServiceMode (Priority 1+). The AliasMode acts like a CNAME that is allowed at the apex.

mydomain.example. 300 IN HTTPS 0 mydomain.hostingprovider.example.

This record tells the browser to look up HTTPS (and A/AAAA) records for the target name. The browser still sends mydomain.example as the HTTP authority and makes sure that the TLS certificate presented by the remote server is valid for mydomain.example, even though the connection itself goes to an endpoint under a different name. The target can publish a ServiceMode HTTPS record advertising HTTP/3, ECH, a port, and its IP address hints, as an earlier post describes.

Unlike CNAME, HTTPS AliasMode applies only to the HTTPS service and other records such as NS, MX, or TXT can remain at mydomain.example.

It’s worth mentioning that not all clients ask for HTTPS records so it’s important to keep functional A/AAAA records at the apex, which could point to a lightweight redirector.

The web’s missing record type arrived decades late, but it arrived.