Configuration and domains
Connect a custom domain
Add a domain, configure the exact DNS records Vercel requests, verify ownership, and confirm HTTPS and canonical routing.
A custom domain is one more alias. notes.flaviocopes.com points at the Production environment the same way field-notes.vercel.app does. The difference is that Vercel doesn’t control your DNS, so you have to prove you own the name and point it at Vercel yourself.
Add the domain and read the instructions
Go to the project settings, open Domains, and type the exact hostname. Vercel shows you which DNS record to create. For a subdomain it’s usually a CNAME. For an apex domain like flaviocopes.com it’s an A record, because DNS doesn’t allow a CNAME at the apex.
Copy the value from your own dashboard. Don’t copy it from a blog post, including this one. Record targets can change, and the dashboard is the source of truth.
Create the record at your DNS provider, then wait. Propagation takes anything from a minute to a few hours. Vercel verifies the record and issues a TLS certificate on its own once it sees it.
Check DNS before you open a browser
Ask DNS directly, so you know whether the record is public yet:
dig +short notes.flaviocopes.com CNAME
You should get back the target the dashboard asked for. An empty answer means the record isn’t visible yet, or you created it on the wrong name.
Then check what the server does:
curl -I https://notes.flaviocopes.com | head -3
curl -I http://notes.flaviocopes.com | head -3
The first should return 200. The second should return a 308 redirect to HTTPS. If you added both www and the apex, test both and pick one as the canonical host. Vercel can redirect the other one to it. Decide, don’t leave both serving the same content.
Four moving parts
When a domain doesn’t work, a browser error tells you nothing about where it broke. Separate the layers:
- the registrar delegates the domain to a set of nameservers
- the DNS provider publishes the records
- Vercel verifies the hostname and serves the certificate
- the project assigns the domain to an environment
Walk them in that order. dig NS, then dig CNAME or dig A, then the Domains page, then the deployment the domain is attached to. If you need a refresher on the DNS side, the DNS course covers it.
Migrating an existing domain
Write down the current DNS values before you change anything. Lower the TTL a day ahead, so caches expire fast. And keep the old host serving until traffic has fully moved. Domain rollback is just DNS again, and DNS is slow to forget.
Try this on your own project: use a domain or a disposable subdomain you control, add it to the project, create the record, and inspect it with dig and curl before you open it in a browser.
Lesson completed