Vercel deployment solution

Redirect Your Apex Domain to Your Vercel App

Vercel routes custom domains through cname.vercel-dns.com, but DNS standards forbid CNAME records on the apex. ApexToWWW fills the gap with a free, DNS-based 301 redirect from your naked domain to the www subdomain Vercel actually wants.

The Vercel DNS Situation

If you have ever added a custom domain to a Vercel project, you have run into the vercel apex domain problem. Vercel hands you a friendly setup screen that asks you to add either a CNAME for www or an A record for the vercel root domain. The recommended path is the CNAME, because cname.vercel-dns.com resolves to whichever edge node is closest to your visitor and gets updated automatically as Vercel grows its network.

The complication is that DNS does not allow a CNAME record at the apex (also called the zone apex, naked domain, or root domain). RFC 1034 forbids a CNAME at any name that also has SOA and NS records, which is exactly what your apex has. So Vercel suggests an alternative: a plain A record pointing to 76.76.21.21, their Anycast IP for apex domains.

That works, but it has trade-offs:

  • It bypasses CNAME-based routing. The CNAME flow lets Vercel return different IPs per request based on geography, network, and load. The single A record at 76.76.21.21 is a more static entry point and may not always pick the optimal edge.
  • No native IPv6 path on apex. Vercel does not publish a matching AAAA address for the apex Anycast endpoint, so IPv6 visitors hitting your naked domain may fall back to IPv4 or fail entirely depending on their resolver.
  • Edge Functions and middleware behave inconsistently on apex. Some advanced features in the Vercel platform — including certain Edge Function configurations, custom middleware behavior, and ISR cache invalidation — assume the CNAME-based setup. Putting your traffic on the apex A record can produce subtle differences from your www behavior.
  • You end up serving two URLs. Without an explicit redirect, both yourdomain.com and www.yourdomain.com may render your app, splitting analytics, dropping cookies twice, and creating duplicate-content headaches for SEO.

The cleaner approach is to put your real site on www.yourdomain.com via the recommended CNAME and use a tiny redirect service for the apex. That is what ApexToWWW does — and it is a drop-in 76.76.21.21 alternative that gives you proper IPv6, a real 301, and clean separation.

Step-by-Step: Vercel + ApexToWWW

Here is the full vercel naked domain redirect setup, end to end. It assumes you already have a Vercel project deployed.

  1. Step 1 — Add www in Vercel. In the Vercel dashboard, open your project, then go to Settings → Domains and add www.yourdomain.com. Vercel will display the DNS records you need to add at your registrar.
  2. Step 2 — Add the www CNAME at your DNS provider. Vercel will tell you to add a CNAME record: host www, value cname.vercel-dns.com. Save it. This is the vercel custom domain www entry that does the real work.
  3. Step 3 — Add the apex A record (ApexToWWW). Add a new A record: host @ (or leave blank), value 65.21.184.101. Remove any existing A record on @ first, including any old 76.76.21.21 entry from a previous Vercel setup.
  4. Step 4 — Add the apex AAAA record (ApexToWWW). Add an AAAA record: host @, value 2a01:4f9:c012:a304::1. This gives IPv6 visitors a clean redirect path that the Vercel apex IP cannot offer.
  5. Step 5 — Mark www as primary in Vercel. Back in the Vercel Domains panel, find www.yourdomain.com and set it as the primary domain. This makes Vercel canonicalize internal links and the ISR cache to the www hostname.
  6. Step 6 — Verify. Wait a few minutes for DNS to propagate, then run curl -I https://yourdomain.com. You should see HTTP/2 301 and location: https://www.yourdomain.com/. Visit https://yourdomain.com/some/path?q=1 in a browser and confirm you land on the same path under www.

DNS Records for Vercel + ApexToWWW

Type Name / Host Value Purpose
CNAME www cname.vercel-dns.com Vercel app
A @ 65.21.184.101 ApexToWWW (IPv4)
AAAA @ 2a01:4f9:c012:a304::1 ApexToWWW (IPv6)

Vercel Apex Alternatives Compared

If you are deciding between Vercel’s built-in apex A record and a redirect service, this is the trade-off:

Method CNAME used IPv6 CDN optimized
Vercel A record (76.76.21.21) No No Partial
ApexToWWW redirect For www only Yes Yes

The redirect path is what most production Vercel sites end up doing once they outgrow the quick-start A record.

Works With Other Platforms Too

The same two records work for any host that prefers a CNAME on www. If you are not on Vercel, see the platform-specific guides:

Vercel-Specific FAQ

Does this work with Vercel Edge Functions?

Yes. All your real traffic continues to hit Vercel through the www CNAME, which is the canonical setup that Edge Functions, middleware, and Edge Config all expect. ApexToWWW only handles the bare-domain hit and immediately 301s to www, where Vercel takes over and runs your edge logic exactly as designed.

Can I still use Vercel Analytics?

Yes. Vercel Analytics, Speed Insights, and Web Analytics all attach to the project, not the hostname. Once www.yourdomain.com is set as primary in Vercel and traffic redirects there, every analytics event is recorded normally. There is no double-counting from the apex hit because the redirect happens at the network layer before any page renders.

What about preview deployments?

Untouched. Preview deployments use Vercel-generated subdomains (your-project-git-branch.vercel.app) and never resolve through your apex. ApexToWWW only sees requests to your registered apex domain, so preview URLs, branch deployments, and the production *.vercel.app URL all keep working as before.

Does it preserve Vercel’s SSL?

Yes, on both ends. Vercel continues to issue and renew its own Let’s Encrypt certificate for www.yourdomain.com. ApexToWWW issues a separate Let’s Encrypt certificate for yourdomain.com automatically on first request, so HTTPS works on the apex too — and after the 301 the browser is on Vercel’s certificate. No mixed-content warnings, no manual cert management.

Ship Your Vercel Apex Redirect in 2 Minutes

Two DNS records. No signup. Free forever. Works with Vercel’s CNAME setup out of the box.

Get Started

Questions? Email [email protected]