Skip to content

Instantly share code, notes, and snippets.

@nivethan-me
Last active September 4, 2024 06:41
Show Gist options
  • Save nivethan-me/a56f18b3ffbad04bf5f35085972ceb4d to your computer and use it in GitHub Desktop.
Save nivethan-me/a56f18b3ffbad04bf5f35085972ceb4d to your computer and use it in GitHub Desktop.
Add Cloudflare Custom Domain to Vercel

Add Cloudflare custom domain to Vercel

  1. Sign up and sign in to Cloudflare https://dash.cloudflare.com/sign-up.

  2. In your Cloudflare dashboard, select the Domain Registration > Register Domains tab.

  3. Search for your favorite domain and purchase it. In my case, I purchased the domain https://nivethan.me/ for my portfolio.

  4. Sign in to Vercel and go to your dashboard, where you can see all your projects in the Overview tab.

  5. Click on a project and on the top right, select Domains.

  6. Type your domain in the text box, e.g., nivethan.me, and click Add.

  7. Select the recommended option: Add www.nivethan.me and redirect nivethan.me to it.

  8. Vercel will show an invalid configuration under your domains and display the relevant A record IP under nivethan.me and a CNAME IP under www.nivethan.me. These need to be set up on Cloudflare to make it work.

  9. Go to the Cloudflare dashboard and select Domain Registration > Manage Domains tab.

  10. Your domain will be listed in a table. Select Manage.

  11. Look for Update DNS configuration under the quick actions.

  12. Add an A record (turn off proxy):

    Type Name(required) IPv4 address(required) Proxy status
    A @ 89.28.116 off
  13. Add a CNAME record (turn off proxy):

    Type Name(required) IPv4 address(required) Proxy status
    CNAME www cname.vercel-dns.com off
  14. You're done! Visit your domain, and you should now see your project live and accessible.


Releated Documentation Links

Using Cloudflare as your DNS provider

@rahulmore01
Copy link

thanks for this, btw why proxy status off?

@abbott
Copy link

abbott commented Aug 7, 2024

thanks for this, btw why proxy status off?

This ensures DNS queries result in Vercel serving the request instead of Cloudflare.

https://vercel.com/docs/integrations/external-platforms/cloudflare#disable-the-cloudflare-proxy

@wanghaisheng
Copy link

you miss ns2.vercel-dns.com setting in cf?

@nivethan-me
Copy link
Author

nivethan-me commented Aug 25, 2024

you miss ns2.vercel-dns.com setting in cf?

In Cloudflare i only added a A record and a CNAME record. thats it.

Check the docs for more clarity
https://vercel.com/docs/integrations/external-platforms/cloudflare#using-cloudflare-as-your-dns-provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment