Overview
This guide provides a step-by-step process for connecting a custom Cloudflare domain to a Vercel project. Starting from purchasing a domain to setting up DNS configurations, it covers how to add both A and CNAME records in Cloudflare, enabling the site to go live and be accessible on the chosen domain.
Add Cloudflare custom domain to Vercel
-
Sign up and sign in to Cloudflare https://dash.cloudflare.com/sign-up.
-
In your Cloudflare dashboard, select the
Domain Registration > Register Domainstab. -
Search for your favorite domain and purchase it. In my case, I purchased the domain https://devjourney.me/ for my portfolio.
-
Sign in to Vercel and go to your dashboard, where you can see all your projects in the
Overviewtab. -
Click on a project and on the top right, select
Domains. -
Type your domain in the text box, e.g.,
devjourney.me, and clickAdd. -
Select the recommended option:
Add www.devjourney.me and redirect devjourney.me to it. -
Vercel will show an invalid configuration under your domains and display the relevant A record IP under
devjourney.meand a CNAME IP underwww.devjourney.me. These need to be set up on Cloudflare to make it work. -
Go to the Cloudflare dashboard and select
Domain Registration > Manage Domainstab. -
Your domain will be listed in a table. Select
Manage. -
Look for
Update DNS configurationunder the quick actions. -
Add an A record (turn off proxy):
Type Name(required) IPv4 address(required) Proxy status A @ xx.xx.xx.xx off -
Add a CNAME record (turn off proxy):
Type Name(required) IPv4 address(required) Proxy status CNAME www cname.vercel-dns.com off -
You’re done! Visit your domain, and you should now see your project live and accessible.