| | |

Vercel 05 ▲ Custom Domains & DNS — Configuring apex domains, subdomains, SSL certificates, and domain redirects

⏱️ Estimated read: 10 min | |

Vercel provides a sophisticated domain management system designed to abstract the complexities of DNS records, SSL certificate issuance, and global traffic routing. While most hosting providers require manual intervention to set up HTTPS or manage complex redirect logic between apex domains and subdomains, Vercel automates these processes. By integrating directly with the Let’s Encrypt Certificate Authority and maintaining its own global Anycast DNS network, Vercel ensures that custom domains are not just pointers to an IP address, but fully managed entry points into a high-performance edge network.

Connecting a custom domain to a Vercel project transforms a generic .vercel.app preview URL into a branded production environment. This process involves a handshake between your domain registrar (such as GoDaddy, Namecheap, or Google Domains) and Vercel’s infrastructure. Vercel supports two primary methods for domain integration: using Vercel as your DNS provider (by changing nameservers) or using external DNS management (by adding specific A, CNAME, or TXT records).

This chapter covers the technical implementation of apex domains and subdomains, the automation of SSL/TLS certificate renewals, and the configuration of permanent domain-level redirects. The sections that follow explore the dashboard management interface, the differences between DNS record types, and the lifecycle of certificate issuance and propagation across the global edge.

Key point: Vercel automates the entire lifecycle of custom domains—including DNS verification, global SSL issuance via Let’s Encrypt, and automatic WWW-to-Apex redirection—allowing developers to map branded URLs to deployments without manual server configuration.


Why X exists

The SSL/TLS configuration problem. Manually managing SSL certificates involves generating CSRs, purchasing certificates, installing them on servers, and tracking expiration dates to avoid site downtime. Vercel exists to automate this entirely through Let’s Encrypt, providing zero-config HTTPS that renews automatically before expiration.

The apex domain redirection problem. Users often type both example.com and www.example.com. Maintaining consistency requires configuring a 301 redirect from one to the other. Vercel provides a built-in toggle to handle these redirects at the edge, ensuring that search engines and users are always directed to a single canonical version of the site.

The DNS propagation latency problem. Traditional DNS changes can take up to 48 hours to propagate globally. Vercel’s Anycast network and optimized DNS infrastructure aim to reduce this window, providing real-time status feedback in the dashboard so developers know exactly when their domain is ready for traffic.

The environment isolation problem. Production sites need a primary domain, but staging and development environments often need their own subdomains (e.g., staging.example.com). Vercel allows for granular mapping where specific Git branches are automatically deployed to specific subdomains, ensuring that production and staging environments never collide.

The certificate authority friction problem. Coordinating between a domain registrar, a certificate authority, and a hosting provider creates multiple points of failure. By centralizing the verification and issuance process, Vercel reduces the “handshake” overhead, making domain setup a matter of minutes rather than hours.


a. Domain Management and Project Mapping

Adding a domain to a Vercel project starts in the “Domains” section of the Project Settings. When a domain is entered, Vercel immediately checks for a valid DNS configuration. If the domain is not yet configured, Vercel provides the exact records required to verify ownership and route traffic.

// Internal representation of a domain mapping
{
  "name": "example.com",
  "apexName": "example.com",
  "projectId": "prj_12345",
  "redirect": "www.example.com", // Optional redirect target
  "verified": true
}

Vercel treats domains as first-class citizens that are mapped to specific deployment contexts. By default, a domain is mapped to the Production deployment (the code on your main or master branch). However, you can also map subdomains to specific feature branches. This is particularly useful for enterprise workflows where a release-v2 branch needs to be accessible at v2.example.com for final stakeholder approval before being merged into the primary production branch.

The dashboard provides a real-time status indicator (Valid/Invalid/Pending). If a domain shows “Invalid Configuration,” Vercel displays a comparison between the “Expected” DNS records and the “Current” records found on the open internet, simplifying the troubleshooting process for developers who may not be DNS experts.


b. Apex Domains vs. Subdomains: A and CNAME Records

The technical implementation of a domain depends on whether it is an “Apex” domain (the root domain like example.com) or a “Subdomain” (like www.example.com or app.example.com). Because the DNS specification does not allow CNAME records at the apex level, different record types must be used.

For an Apex Domain, Vercel requires an A Record pointing to a specific IP address (currently 76.76.21.21). This routes the root traffic to Vercel’s global edge load balancer.

# Example DNS A-Record for Apex
example.com.  IN  A  76.76.21.21

For a Subdomain, the standard approach is to use a CNAME Record pointing to cname.vercel-dns.com. This is more flexible than an A record because it allows Vercel to update its underlying IP infrastructure without requiring you to change your DNS settings.

# Example DNS CNAME-Record for Subdomain
www.example.com.  IN  CNAME  cname.vercel-dns.com.

Vercel also supports Nameserver Delegation. If you change your domain’s nameservers to Vercel’s (e.g., ns1.vercel-dns.com), Vercel becomes your DNS host. This is the “Zero Config” path, as Vercel can then automatically create the necessary A and CNAME records, manage TXT records for verification, and handle all subdomains without you ever visiting your registrar’s dashboard again.


c. SSL Certificates and Domain Redirection Logic

Every domain successfully connected to Vercel receives an automated SSL/TLS certificate. Vercel utilizes Let’s Encrypt to issue these certificates. The process is “Pull-based”: once Vercel detects that the DNS records are correctly pointing to its servers, it initiates a challenge to verify control of the domain and then requests the certificate.

# Logic flow for SSL issuance
1. DNS verification detected
2. ACME Challenge initiated
3. Let's Encrypt issues certificate
4. Certificate deployed to global Edge (100+ PoPs)
5. Success: HTTPS becomes active

Domain redirection is a core feature that prevents “split traffic.” In the Vercel dashboard, if you have both example.com and www.example.com added, you can click “Edit” on the apex domain and set it to redirect to the www version (or vice versa). Vercel implements this as a 301 Permanent Redirect at the Edge. This is superior to application-level redirects because it happens before the request even reaches your code, reducing latency and consolidating SEO “link juice” into a single canonical URL.

If you are using Vercel Nameservers, you can also manage Wildcard Domains (e.g., *.example.com). This allows you to programmatically create subdomains for different users or tenants in a SaaS application, with Vercel handling the SSL issuance for the entire wildcard pattern.


Complete Example Session

# ============================================
# PART 1: ADDING A DOMAIN VIA CLI
# ============================================
vercel domains add my-awesome-app.com

# ============================================
# PART 2: CHECKING DNS STATUS
# ============================================
vercel domains inspect my-awesome-app.com

# ============================================
# PART 3: APEX A-RECORD (External DNS)
# ============================================
# Type: A
# Name: @ (or empty)
# Value: 76.76.21.21

# ============================================
# PART 4: SUBDOMAIN CNAME (External DNS)
# ============================================
# Type: CNAME
# Name: www
# Value: cname.vercel-dns.com.

# ============================================
# PART 5: CONFIGURING VERCEL NAMESERVERS
# ============================================
# Log in to Registrar (e.g., GoDaddy)
# Set Nameservers:
# ns1.vercel-dns.com
# ns2.vercel-dns.com

# ============================================
# PART 6: VERIFYING SSL ISSUANCE
# ============================================
curl -Iv https://my-awesome-app.com
# Look for: Server: Vercel
# Look for: SSL certificate verify ok

# ============================================
# PART 7: MAPPING BRANCH TO SUBDOMAIN
# ============================================
# Dashboard > Domains > Add 'staging.my-app.com'
# Select Git Branch: 'develop'

# ============================================
# PART 8: SETTING CANONICAL REDIRECTS
# ============================================
# Dashboard > Domains > example.com > Edit
# Redirect to: www.example.com

# ============================================
# PART 9: CREATING A WILDCARD DOMAIN
# ============================================
# Only available via Vercel Nameservers
vercel domains add *.my-saas-app.com

# ============================================
# PART 10: REMOVING A DOMAIN
# ============================================
vercel domains rm my-awesome-app.com

The session above demonstrates the lifecycle of domain management, from initial CLI registration and record configuration to branch mapping, SSL verification, and final cleanup.


Quick Reference

Recommended DNS Records (External)

Record TypeHostValuePurpose
A@76.76.21.21Routes Apex (root) domain
AAAA@2600:9000:a101::1Routes Apex (IPv6)
CNAMEwwwcname.vercel-dns.com.Routes standard subdomains
CNAME*cname.vercel-dns.com.Routes wildcard subdomains

Vercel Nameservers (Managed)

ServerAddress
Primaryns1.vercel-dns.com
Secondaryns2.vercel-dns.com

Redirect Status Codes

CodeTypeBehavior
301PermanentCached by browsers; best for SEO
302TemporaryNot cached; used for maintenance
307TemporaryPreserve request method (POST/GET)
308PermanentPreserve request method; best for modern APIs

Best Practices

✅ Do This:

# Prefer CNAME for subdomains to allow IP flexibility
www.example.com. IN CNAME cname.vercel-dns.com.              # ✅

# Use Vercel Nameservers for "Zero Config" experience
# (Automatic verification and wildcard support)               # ✅

# Configure one canonical domain (WWW or Apex) and redirect
# example.com -> www.example.com                              # ✅

# Map staging subdomains to non-production branches
# staging.example.com -> 'develop' branch                     # ✅

❌ Don’t Do This:

# Don't point multiple CNAMEs to each other
# (Create a direct link to cname.vercel-dns.com)              # ❌

# Don't use proxy services (like Cloudflare) without
# disabling "Orange Cloud" during initial verification        # ❌

# Don't hardcode IP addresses other than 76.76.21.21
# (Vercel IPs may change outside of this specific load balancer)# ❌

# Don't forget to add both Apex and WWW domains to the project# ❌

Common Pitfalls

PitfallWhy It HappensFix
Domain Verification FailedDNS records haven’t propagatedWait 10-60 mins or check for conflicting records
SSL “Circular Redirect”Cloudflare/Proxy setting mismatchSet Cloudflare SSL to “Full (Strict)”
404 on SubdomainSubdomain not added to Vercel ProjectAdd the specific subdomain in Settings > Domains
Mixed Content WarningLinking to http:// resourcesChange all asset links to https://
Apex not workingMissing A record or using CNAME at rootEnsure 76.76.21.21 A record is present
Wrong Branch DisplayedDomain mapped to incorrect Git branchUpdate mapping in Domain Settings

Real-World Examples

1. Standard Apex Setup

@ A 76.76.21.21

2. Standard WWW Setup

www CNAME cname.vercel-dns.com

3. Staging Environment Subdomain

staging CNAME cname.vercel-dns.com (Mapped to develop branch)

4. Custom API Subdomain

api CNAME cname.vercel-dns.com

5. Documentation Subdomain

docs CNAME cname.vercel-dns.com

6. Redirecting all .net to .com

Add example.net to project and set redirect to example.com

7. Wildcard SaaS Setup

*.user-sites.com added via Vercel Nameservers

8. Transitioning Registrars

Use Vercel Nameservers to maintain site uptime during transfer

9. Global Anycast Optimization

Verify IP 76.76.21.21 routes to nearest edge via traceroute

10. Forcing HTTPS

Automatic via Vercel; no config needed.


Visual

DNS Resolution Flow

┌─────────────────┐       ┌──────────────────────┐       ┌─────────────────┐
│ USER BROWSER    │       │ DNS RESOLVER         │       │ VERCEL EDGE     │
│                 │       │                      │       │                 │
│ Requests:       │──────►│ Looks for A record   │──────►│ Routes to       │
│ example.com     │       │ pointing to          │       │ nearest PoP     │
│                 │       │ 76.76.21.21          │       │ (Anycast IP)    │
└─────────────────┘       └──────────────────────┘       └─────────────────┘

The Apex-to-WWW Redirect Path

┌──────────────────────────────────────────────────────────┐
│ REQUEST: http://example.com                              │
│                                                          │
│ 1. DNS Resolution (A Record 76.76.21.21)                 │
│ 2. Vercel Edge detects "example.com"                     │
│ 3. Edge Config: "Redirect to www.example.com"            │
│ 4. Response: HTTP 301 Permanent Redirect                 │
│ 5. Browser requests: https://www.example.com             │
└──────────────────────────────────────────────────────────┘

Managed vs. External DNS

┌─────────────────────────────┐   ┌─────────────────────────────┐
│ MANAGED (Nameservers)       │   │ EXTERNAL (A/CNAME Records)  │
│                             │   │                             │
│ Registrar -> Vercel NS      │   │ Registrar -> Godaddy/AWS DNS│
│                             │   │                             │
│ [ Vercel automatically ]    │   │ [ Developer manually ]      │
│ [ handles all records  ]    │   │ [ adds 76.76.21.21   ]      │
└─────────────────────────────┘   └─────────────────────────────┘

Summary

ItemValue
Apex A-Record76.76.21.21
Subdomain CNAMEcname.vercel-dns.com
SSL ProviderLet’s Encrypt
Certificate RenewalAutomatic (every 60-90 days)
Redirect Type301 Permanent
Propagation TimeInstant to 48 hours
Nameserversns1.vercel-dns.com, ns2.vercel-dns.com
Wildcard SupportYes (Requires Vercel Nameservers)

Key takeaways:

  • Vercel abstracts the SSL lifecycle. You don’t need to purchase or install certificates; Vercel handles issuance and renewal via Let’s Encrypt automatically.
  • Apex and Subdomains use different records. Use an A record for root domains (like example.com) and a CNAME for subdomains (like www).
  • Nameserver delegation is the easiest path. By using Vercel Nameservers, you let Vercel handle all DNS complexities, enabling features like Wildcard subdomains effortlessly.
  • Redirects are handled at the Edge. Domain-level redirects are fast and SEO-friendly, consolidating your traffic into one canonical URL before it hits your application code.
  • Environment mapping is granular. Domains aren’t just for production; you can map any subdomain to any Git branch to create distinct staging or feature-test environments.

Remember: Domain configuration on Vercel is designed to be a “set it and forget it” process. By correctly setting your A and CNAME records—or delegating Nameservers entirely—you unlock a globally distributed, SSL-secured production environment that automatically stays in sync with your Git workflow.

Was this helpful?


Stop using slow, ad-bloated tool sites! 🤮

🔎 Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
✅ Finance (Mortgage, Interest, Inflation)
✅ Tech (Base64, JSON, Dev Suite, IP)
✅ Health (BMI, BMR, TDEE)
✅ Productivity (Timer, Workspace, QR)

⚡️ Fast & Private
🔒 No data leaves your device
💎 100% Free

🔗 Use it now: https://tools.kandz.me
🔖 Bookmark it—you’ll need it later!