domains · 6 min read

Vercel Custom Domain Setup (Plus Netlify and Cloudflare)

Step-by-step DNS setup for putting your own domain on a Vercel, Netlify or Cloudflare Workers app: apex vs www, the exact records each platform asks for, HTTPS, and fixes for the usual errors.

Published

Reading time

6 min

Written by

KavioWeb

Cover: how to connect a custom domain to Vercel, Netlify or Cloudflare

Some links go through /go/ and may earn us a commission at no extra cost to you. We only recommend tools we would use.

To set up a Vercel custom domain (or one on Netlify or Cloudflare), add the domain in your hosting platform's settings, then create the DNS records it asks for at your DNS provider: an A record (or ALIAS) for the apex domain like example.com, and a CNAME for www. On Vercel, use the project-specific values shown under Settings → Domains. On Netlify, point the apex at apex-loadbalancer.netlify.com (ALIAS) or 75.2.60.5 (A record) and www at your *.netlify.app name. On Cloudflare Workers, add a Custom Domain and Cloudflare creates the records and certificate for you, as long as the domain's DNS is on Cloudflare. HTTPS is issued automatically on all three once DNS resolves.

Diagram: the DNS records that connect a domain to a hosting platform, apex and www

Before you start: apex vs www

  • The apex (or root) domain is example.com. DNS rules do not allow a normal CNAME at the apex, so platforms give you an A record IP or ask for an ALIAS, ANAME or flattened CNAME if your provider supports one.

  • A subdomain such as www.example.com or app.example.com uses a CNAME pointing at the platform.

  • Pick one canonical host and redirect the other to it, so search engines do not see two copies of your site. Vercel's docs recommend using www; Netlify's docs also recommend a subdomain as your primary domain when you use external DNS, because the apex cannot benefit from CDN-level DNS routing.

You need access to wherever your domain's DNS is managed. That is usually your registrar (Namecheap, Porkbun) unless you moved nameservers to Cloudflare or your host. Not bought one yet? See best domain registrar for developers.

Vercel custom domain setup

  1. Open your project, go to Settings → Domains, and add example.com. Vercel will prompt you to add www.example.com as well.

  2. Vercel shows the records it expects. For the apex, add an A record with the recommended IP. For www (or any subdomain), add a CNAME with the recommended project-specific target. Use the values shown for your project rather than an IP copied from a blog post.

  3. Wait for the domain to show as valid. Vercel issues the certificate automatically.

  4. Set a redirect between example.com and www.example.com in the project's domain settings so only one serves the site.

Prefer the terminal? The Vercel CLI does the same:

vercel domains add example.com my-site
vercel domains add www.example.com my-site
vercel domains verify www.example.com --project my-site 

Alternatively, you can switch your domain's nameservers to Vercel and let it manage DNS. Wildcard domains (*.example.com) need the nameserver method or an _acme-challenge delegation for certificates.

Open Vercel

Netlify

  1. In your site, go to Domain management and add your custom domain.

  2. For www or another subdomain, add a CNAME at your DNS provider pointing to your site's Netlify name, for example brave-curie-12345.netlify.app.

  3. For the apex, Netlify gives two options:

    • Recommended: an ALIAS, ANAME or flattened CNAME record at @ pointing to apex-loadbalancer.netlify.com.

    • Fallback: an A record at @ pointing to 75.2.60.5.

  4. Sites on Netlify's High-Performance Edge use a different load balancer: use the value shown in the "Pending DNS verification" details instead.

  5. Netlify adds www automatically when you assign an apex domain, and provisions HTTPS once DNS resolves. Netlify notes propagation can take up to a day.

As an alternative, you can use Netlify DNS by pointing your nameservers to Netlify.

Open Netlify

Cloudflare Workers (and Pages)

Cloudflare is simplest if your domain's DNS is already on Cloudflare, because it creates the records for you.

  1. Get the domain onto Cloudflare DNS if it is not already. Add the domain in the dashboard, then change the nameservers at your registrar to the two Cloudflare assigns. Turn off DNSSEC at the registrar first, as Cloudflare's setup guide instructs. Domains bought through Cloudflare Registrar already use Cloudflare DNS.

  2. Go to Workers & Pages, select your Worker, then Settings → Domains & Routes → Add → Custom Domain, and enter example.com or app.example.com.

  3. Cloudflare creates the DNS record and issues the certificate. All paths on that hostname go to your Worker.

Or declare it in your Wrangler config and deploy:

{
  "routes": [
    { "pattern": "shop.example.com", "custom_domain": true }
  ]
} 

One gotcha from Cloudflare's docs: you cannot create a Custom Domain on a hostname that already has a CNAME record. Delete the old record first.

Open Cloudflare

Troubleshooting

Symptom

Likely cause

Fix

"Invalid configuration" for days

Record added at the wrong DNS provider

Check where nameservers point (dig NS example.com) and edit records there

Apex works, www does not (or the reverse)

Only one record added

Add both, then redirect one to the other

Certificate pending

DNS not resolving to the platform yet, or a CAA record blocks issuance

Wait for propagation; check CAA records

"CNAME not allowed at root"

Your DNS provider does not support apex CNAMEs

Use the A record IP or an ALIAS/ANAME

Cloudflare refuses Custom Domain

Existing CNAME on that hostname

Delete the CNAME, then add the Custom Domain

Old site still shows

DNS caching

Wait for the TTL to expire; test with dig example.com +short

After the domain works

  • Update your app's base URL and canonical URL settings (SITE_URL, NEXTAUTH_URL or your framework's equivalent).

  • Update OAuth redirect URLs at Google, GitHub and others, plus payment webhook endpoints.

  • Set up email records (SPF, DKIM, DMARC) if you send email from the domain.

The rest of the launch list is in the vibe-coded app production checklist. Choosing between these three hosts? See Vercel vs Netlify vs Cloudflare Pages.

FAQ

How long does it take for a custom domain to work?

Often minutes, sometimes longer. Netlify notes DNS propagation can take up to a full day. Nameserver changes, for example moving to Cloudflare, can take longer than adding a single record.

Should I use www or the root domain?

Either works if you redirect the other. Vercel recommends www, and Netlify recommends a subdomain as primary when you use external DNS, because the apex cannot use CDN-level DNS routing.

Do I need to buy an SSL certificate?

  1. Vercel, Netlify and Cloudflare issue and renew certificates automatically once your DNS points to them.

Can I use a domain from Namecheap or Porkbun with Vercel?

Yes. Add the domain in Vercel, then create the A and CNAME records Vercel shows in your registrar's DNS settings. Or change the nameservers to Vercel and manage DNS there.

Why can't I add a CNAME for my root domain?

The DNS standard does not allow a CNAME at the apex alongside the other records a root domain needs. Use the A record the platform provides, or an ALIAS, ANAME or flattened CNAME if your DNS provider supports one.

Want the launch handled?

Kavio sets up domains, DNS, HTTPS, redirects and email records for AI-built apps, and checks the rest of your launch list. See our services or get in touch.

Sources

  1. Vercel: Set up a custom domain
  2. Vercel: Add a domain
  3. Netlify: Configure external DNS
  4. Cloudflare Workers: Custom Domains
  5. Cloudflare: Change your nameservers (full setup)

Next article

All articles →
Cover: Railway vs Render vs Fly.io backend hosting comparison

hosting · 6 min read

Railway vs Render vs Fly.io: Where to Run Your Backend

Railway, Render and Fly.io compared for hosting the backend of an AI-built app: free tiers and their catches, pricing as of November 2026, databases, and which platform fits which app.

Read next ↗