DEV Community

nikhil mahato
nikhil mahato

Posted on

Connecting a Custom Domain to Vercel

Connecting a Custom Domain to Vercel

If you’re using Vercel to deploy your projects, connecting a custom domain is straightforward and only takes a few steps. Here’s a quick guide to get your domain up and running with your Vercel-hosted application.

Step 1: Add Your Project to Vercel

  1. Deploy your app to Vercel (e.g., using vercel CLI or GitHub integration).
  2. Open your project dashboard on Vercel.

Step 2: Add Your Custom Domain

  1. Go to Project Settings → Domains.
  2. Click “Add” and enter your custom domain (e.g., yourdomain.com).
  3. Vercel will check if the domain is already configured. If not, it will guide you to add DNS records.

Step 3: Configure DNS Records

You need to update your domain registrar's DNS settings.

Vercel typically requires:

  • A Record: Points @ (root domain) to Vercel’s IP:
  76.76.21.21
Enter fullscreen mode Exit fullscreen mode
  • CNAME Record: Points www to cname.vercel-dns.com.

If you’re using a subdomain (e.g., blog.yourdomain.com), add a CNAME for that subdomain pointing to cname.vercel-dns.com.

Step 4: Verify the Domain

  • After updating DNS records, return to your Vercel dashboard.
  • Click Verify on the domain you added.
  • DNS propagation might take a few minutes (or up to 24 hours).

Step 5: Set as Primary Domain

  • Once verified, set the domain (e.g., yourdomain.com) as the primary domain in the Vercel dashboard.
  • Optionally, redirect www to your main domain (Vercel provides a toggle for this).

Step 6: Enable HTTPS

  • Vercel automatically provisions SSL/TLS certificates (via Let’s Encrypt) for your domain.
  • Within a few minutes, your site will be accessible via https://yourdomain.com.

Pro Tips

  • Subdomains: You can add multiple subdomains in the same way (e.g., api.yourdomain.com).
  • Custom DNS: If your DNS is not managed by your domain provider, you can use Vercel’s built-in Vercel DNS for simplicity.
  • Instant Preview Links: Keep using Vercel’s preview URLs (.vercel.app) while working on staging versions.

Conclusion:

That’s it! You’ve successfully connected your custom domain to your Vercel project. Now your application is live at your own branded domain.

Top comments (0)