2026-05-04

The right way to attach a custom domain on Vercel

I deployed. The site updated. The custom domain didn't.

This will happen to you exactly once on Vercel — when you ship a new production deploy and your custom domain stays pointed at yesterday's build. Two extra commands fix it:

vercel alias set <new-deployment-url> ericwalters.dev
vercel alias set <new-deployment-url> www.ericwalters.dev

Run those, the domain rotates, and you move on. Until you deploy again. And again. Two extra commands per deploy, multiplied across every change you ever ship.

The wrong-looking fix

vercel alias set is the first command the docs and StackOverflow serve you. It works. It also pins the domain to one specific deployment. The next prod deploy gets a fresh URL — and your custom domain doesn't follow, because nobody told it to.

That's the trap: the command does what it advertises. It just does the wrong thing for an attached custom domain.

The actual fix

One line in vercel.json:

{
  "alias": ["ericwalters.dev", "www.ericwalters.dev"]
}

Vercel re-applies this on every production deploy. The custom domains follow whichever build is currently --prod, automatically, forever. No CLI commands. No manual rotation.

I verified this on two consecutive vercel deploy --prod runs yesterday. Each one auto-claimed both domains. The friction is genuinely gone.

How to confirm it's working

vercel alias ls | grep <your-domain>

Both your apex and www should show the latest deployment ID after any prod deploy. If they don't, you have an explicit vercel alias set pin from a previous session — re-deploy with the alias field in vercel.json and the next deploy will reclaim them.

The pattern worth naming

Vercel offers two ways to attach a domain to a deployment: pinned (vercel alias set) and auto-rotating (vercel.json alias). The pinned one is what surfaces when you search for the symptom. The auto-rotating one is what you actually want for any domain that should track production.

Any time a tool gives you two similar-looking mechanisms — one one-shot, one persistent — and you discover the one-shot first, you carry that friction forever. Read past the first answer.