Custom Domains & SSL
Add your own domain to Vercel with automatic HTTPS. Configure DNS, subdomains, and redirects.
What you'll accomplish
Your custom domain pointing to your Vercel deployment with HTTPS
Prerequisites
- Project deployed to Vercel
- Domain registered (any registrar)
How Domains Work on Vercel
When you add a custom domain, Vercel:
- Verifies you own the domain (via DNS)
- Provisions an SSL certificate (free, automatic)
- Routes traffic to your deployment
- Renews certificates automatically
User types: example.com
↓
DNS: example.com → Vercel's servers
↓
Vercel: Routes to your project
↓
User sees: Your app (with HTTPS!)
Adding a Domain
Via Dashboard
- Go to your project in Vercel
- Click Settings → Domains
- Enter your domain (e.g.,
example.com) - Click Add
- Follow the DNS configuration instructions
Via CLI
bash# Add domain to current project vercel domains add example.com # Add domain to specific project vercel domains add example.com --scope your-team
DNS Configuration
After adding a domain, configure your DNS. You have two options:
Option A: Using Vercel Nameservers (Recommended)
Transfer DNS management to Vercel for the simplest setup.
At your registrar, change nameservers to:
ns1.vercel-dns.com
ns2.vercel-dns.com
Benefits:
- Vercel manages all DNS records
- Automatic configuration
- Easy subdomain management
- Fastest propagation
Option B: Keep Existing DNS
Add these records at your current DNS provider:
For root domain (example.com):
Type: A
Name: @
Value: 76.76.21.21
For www subdomain:
Type: CNAME
Name: www
Value: cname.vercel-dns.com.
Note
If your DNS provider doesn't support CNAME at the root (apex) domain, you'll need to use Vercel Nameservers or a provider that supports ALIAS records.
Domain Verification
After adding DNS records, Vercel verifies ownership:
Status: Pending Verification
↓ (DNS propagates)
Status: Valid Configuration
↓ (SSL provisioning)
Status: Valid ✓
Check Status
bashvercel domains inspect example.com # Output: # Domain: example.com # Status: Valid # SSL: Active (auto-renewing) # Nameservers: Vercel
DNS Propagation
DNS changes can take up to 48 hours, but usually complete within minutes to hours.
Check propagation:
bash# Check locally dig example.com A # Should return 76.76.21.21
Common Domain Configurations
Root + WWW (Most Common)
example.com → Your app
www.example.com → Redirects to example.com
Setup in Vercel:
- Add
example.com(primary) - Add
www.example.com(redirects automatically)
WWW as Primary
www.example.com → Your app
example.com → Redirects to www.example.com
Setup:
- Add
www.example.com(primary) - Add
example.com(set to redirect)
Subdomain Only
app.example.com → Your app
Setup:
- Add
app.example.com - Configure CNAME:
app → cname.vercel-dns.com
Subdomains
Adding Subdomains
bash# Add subdomain vercel domains add blog.example.com vercel domains add api.example.com vercel domains add staging.example.com
Wildcard Subdomains
For dynamic subdomains (e.g., tenant.example.com):
bashvercel domains add "*.example.com"
In your app, read the subdomain:
javascript// Next.js middleware export function middleware(request) { const host = request.headers.get('host'); const subdomain = host.split('.')[0]; // Use subdomain for routing, tenant identification, etc. }
Multiple Domains
Point multiple domains to the same project:
bashvercel domains add example.com vercel domains add example.org vercel domains add myapp.io
One domain is "primary" (canonical), others redirect or serve directly.
Setting Primary Domain
In Dashboard: Settings → Domains → Click ⋯ → Set as Primary
The primary domain is used in:
- Canonical URLs
- Sitemap generation
- SEO-related headers
SSL Certificates
Automatic SSL
Vercel automatically:
- Provisions certificates (Let's Encrypt)
- Installs them on your domain
- Renews before expiration (every 90 days)
You don't need to do anything!
Force HTTPS
All traffic is automatically redirected to HTTPS. No configuration needed.
Custom Certificates (Enterprise)
Enterprise plans can upload custom SSL certificates for specific compliance requirements.
Redirects
Domain Redirects
When you add multiple domains, configure how they behave:
| Domain | Behavior |
|---|---|
example.com | Primary (serves content) |
www.example.com | Redirects to example.com |
example.org | Redirects to example.com |
In vercel.json
json{ "redirects": [ { "source": "/:path*", "has": [{ "type": "host", "value": "old-domain.com" }], "destination": "https://new-domain.com/:path*", "permanent": true } ] }
Troubleshooting
"Invalid Configuration"
Usually means DNS records aren't correct.
bash# Check DNS dig example.com A # Should return: 76.76.21.21 dig www.example.com CNAME # Should return: cname.vercel-dns.com
"Pending Verification"
- Wait for DNS propagation (up to 48 hours)
- Verify DNS records are correct
- Clear DNS cache:
sudo dscacheutil -flushcache(macOS)
SSL Certificate Error
Usually resolves automatically. If persistent:
- Remove the domain
- Wait 5 minutes
- Add it again
"Domain Already In Use"
The domain is assigned to another Vercel project.
- Find which project has it (check all teams)
- Remove from that project first
- Add to your project
Mixed Content Warnings
Your app loads HTTP resources on HTTPS pages.
javascript// Bad <img src="http://example.com/image.png" /> // Good <img src="https://example.com/image.png" /> // Better (protocol-relative) <img src="//example.com/image.png" /> // Best (relative) <img src="/image.png" />
Domain Management
List Domains
bashvercel domains ls # Output: # ┌──────────────────────┬─────────┬───────────────┐ # │ Domain │ Status │ Added │ # ├──────────────────────┼─────────┼───────────────┤ # │ example.com │ Valid │ 7 days ago │ # │ www.example.com │ Valid │ 7 days ago │ # │ staging.example.com │ Valid │ 2 days ago │ # └──────────────────────┴─────────┴───────────────┘
Remove Domain
bashvercel domains rm example.com
Transfer Domain (Between Projects)
- Remove from old project
- Add to new project
- DNS remains the same
Registrar-Specific Instructions
GoDaddy
- Go to Domain Settings → DNS Management
- Change nameservers to Vercel, OR
- Add A record:
@→76.76.21.21 - Add CNAME:
www→cname.vercel-dns.com
Namecheap
- Go to Domain List → Manage → Advanced DNS
- Add A record:
@→76.76.21.21 - Add CNAME:
www→cname.vercel-dns.com
Cloudflare
- DNS → Add Record
- A record:
@→76.76.21.21(Proxy OFF/DNS only) - CNAME:
www→cname.vercel-dns.com(Proxy OFF)
Note
When using Cloudflare, set the proxy status to "DNS only" (gray cloud) for Vercel to work properly.
Google Domains / Squarespace
- DNS → Manage custom records
- Add A:
@→76.76.21.21 - Add CNAME:
www→cname.vercel-dns.com
Note
Checkpoint: Add your custom domain, configure DNS, and verify it's working by visiting https://your-domain.com.