Custom Domain + DNS on Vercel
Custom Domain + DNS on Vercel
What Happens When Someone Types Your URL
User types: myapp.com
↓
Browser checks local DNS cache
↓ (cache miss)
OS queries configured DNS resolver (usually ISP or 8.8.8.8)
↓
Resolver queries root nameservers → TLD nameservers (.com)
↓
TLD nameservers return your domain's authoritative nameservers
↓
Authoritative nameserver returns IP address (A record)
↓
Browser connects to that IP (Vercel's load balancer)
↓
Vercel routes request to your deployment
↓
Response arrives at browser (~50ms total)---
Adding a Domain to Vercel
- Vercel Dashboard → Your Project → Settings → Domains
- Type your domain:
myapp.com - Vercel shows you the required DNS records
Option A: Use Vercel as your DNS (recommended)
Transfer nameservers to Vercel at your registrar:
ns1.vercel-dns.com
ns2.vercel-dns.comVercel manages all DNS records. Automatic SSL. Easy subdomain setup.
Option B: Keep your registrar's DNS
Add the records Vercel specifies:
Type Name Value
A @ 76.76.21.21 ← apex domain (myapp.com)
CNAME www cname.vercel-dns.com ← www subdomain---
Common DNS Mistakes
CNAME on apex domain: Many registrars don't allow CNAME on the root (@) domain. Use an A record or ALIAS record instead.
Wrong TTL during migration:
- Before migrating: set TTL to 60 seconds (changes propagate in 1 minute)
- After migration is stable: raise TTL back to 3600 (reduces DNS load)
Propagation delay: DNS changes take time to propagate globally. "Propagation" means different DNS resolvers around the world picking up your changes. Use [whatsmydns.net](https://whatsmydns.net) to check propagation status.
---
Subdomains for Staging
myapp.com → production (main branch)
staging.myapp.com → staging (develop branch)
api.myapp.com → your Railway backendIn Vercel: Settings → Domains → Add staging.myapp.com and assign it to a specific git branch.
CNAME staging cname.vercel-dns.com
CNAME api your-service.up.railway.app---
SSL Certificates: Automatic
Vercel automatically:
- Detects new custom domains
- Requests a Let's Encrypt certificate
- Renews it before expiry
- Forces HTTPS (HTTP redirects to HTTPS)
Zero configuration required. If you see an SSL error, check:
- DNS is pointing to Vercel (not the old host)
- The domain is added in Vercel's dashboard
- Wait 5-10 minutes after DNS change (certificate provisioning takes a moment)