Skip to content

Instantly share code, notes, and snippets.

@khushal87
Last active April 25, 2024 13:13
Show Gist options
  • Star 115 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save khushal87/81b7b74c4e5324b2ff29bbc51f059513 to your computer and use it in GitHub Desktop.
Save khushal87/81b7b74c4e5324b2ff29bbc51f059513 to your computer and use it in GitHub Desktop.
Linking a custom domain from Google domains to Vercel app

Linking a custom domain to a deployed application is confusing and at times you don't get a route on how to link the domain with the website. 😫

In this article, I will be explaining how to link a Custom domain brought in Google Domains service to an application hosted on Vercel.

Perks of using vercel is that it allows adding domain without any verification unlike Heroku/Netlify, which means you don't have to add your billing details to add a domain to your application. Moreover, it is fast, efficient, and easy to use.😁

What is Vercel?

​Vercel is a deployment and collaboration platform for frontend developers. ​Vercel enables developers to host websites and web services that deploy instantly and scale automatically – all without any configuration. Source - Official Docs

What is Google Domain Service?

Google Domains is a domain name registrar operated by Google. Google Domains offers domain registration, DNS hosting, DNSSEC, Dynamic DNS, domain forwarding, and email forwarding. It also offers a one-click DNS configuration that connects the domains with Blogger, Google Sites, Squarespace, Weebly, and Shopify. Source - Wikipedia

Without wasting much time, let us go deep on how to do it. 🤔

  • Firstly, you need to make sure your application is deployed and running well on vercel under the .vercel.app domain. Suppose your application name is xyz then the domain on which your application currently running would be xyz.vercel.app.

  • Go to the Settings section in your application workspace and then go to Domains. Under this section, you would see your domains which are currently linked with the application. You would also find the one mentioned above by default.

  • Type the custom domain that you have purchased from Google domains to the Input field in the View Domains section and add the domain.

  • A popup like the one below would appear and you would be asked to choose one of the options. You can choose any of the options among the 3 given ones. Recommended one is the first option, so we will choose that as we want our website to work on both xyz.com and `www.xyz.com.

vercel_popup.PNG

  • Currently both the domains would show Invalid configuration and you need to configure them on the Google Domains Dashboard. So, let us do it.

  • Go to Google Domains Dashboard and choose your domain that you have purchased. Under, the domain workspace, go to the DNS option on the tab to the left of your screen.

gd_dns.PNG

  • Under the DNS section, scroll below and you would get the Custom resource records section.

gd_cdm.PNG

  • Now, we will add the A record for the domain xyz.com and CNAME record for the www.xyz.com as this has an alias www in it.

  • Copy the A record Value from your vercel domain section where you added your domain and add it to the Custom resource records. While adding it, leave the default name the same as @, Type as A, and TTL as 1h. Only add the IPv4 address which you copied from the Vercel Domain section. Click on Add.

  • Copy the CNAME record Value from the vercel domain section where you added your domain and add it to the Custom resource records. While adding it, make sure the Name is www, Type is CNAME, and leave TTL as 1h. Only add the Domain name value which you copied from the Vercel Domain section. Click on Add.

  • Once the above step is configured correctly, wait for some time and you will see Blue ticks under your domain configs in the Vercel dashboard. This means that the configuration and linking were successful and the domain would be linked to your application soon. 🎊 This may take time for some of the users because, the DNS propagation takes 24-48hrs in general. ⌚ But in my case, it hardly took 5 minutes. 😄

  • You can check whether your domain has propagated or not, with this awesome tool DNS Checker.

Kudos 👏👏 your domain is configured and is linked to your Vercel app successfully.

Buy Me A Coffee

Follow and support me -

Github 👨‍💻 - khushal87

LinkedIn 👨‍💻 - Khushal Agarwal

@ShenSeanChen
Copy link

Thanks so much for sharing this!

@graxxia
Copy link

graxxia commented Sep 29, 2022

Thank you for sharing, the pictures helped a lot

@baldm0mma
Copy link

Thanks for this; lifesaver!

@tomcatmew
Copy link

Thanks for this !!!

@tverderesi
Copy link

Thank you! Your tutorial was pretty good and I was able to have my custom domain up and running lightning fast.

@milan-vala
Copy link

thanks, really helpful.

@FarisMarouane
Copy link

Thank you

@jbmerville
Copy link

Very clear. Worked for me. Thanks!!

@Ama-dou
Copy link

Ama-dou commented Feb 5, 2023

Worked for me. Thanks a lot !!

@TheBaconWizard
Copy link

Thanks man, very helpful

@Namnika
Copy link

Namnika commented Feb 14, 2023

Thank you!! Well for me, It took seconds for DNS propagation :)

@Marcelx8
Copy link

Thank you!

@Roburlion
Copy link

You're the man!

@manueldevjour
Copy link

Thanks for the help!

@nwyGit
Copy link

nwyGit commented Mar 12, 2023

Thank you for your help man!

@inyt-app
Copy link

is it possible configure wildcard subdomains from google domains to vercel

@oliveraw
Copy link

very good article thank you!

@AmyRChen
Copy link

This informative article is very helpful. Thank you!

@twsau
Copy link

twsau commented May 22, 2023

absolute beaut

@KutayGuler
Copy link

danke

@jorisfalter
Copy link

Thanks a lot!

@DailyDisco
Copy link

Thanks, starring and commenting for reach

@khushal87
Copy link
Author

Thanks for all the love that I am getting in this Gist ❤️

@DanielOsorio01
Copy link

Thank you a lot!!!

@bobbrysonn
Copy link

Thank you, this worked!

@DamienDeSousa
Copy link

not all superheroes wear a cape <3

@michaelforgit
Copy link

I believe you can no longer use '@' in the name and have to leave it blank. For me, it was not possible to use @. Hopefully this will help someone.

@adasq
Copy link

adasq commented Sep 6, 2023

@michaelforgit that's indeed true, experienced similar issue today :)

@khushal87
Copy link
Author

Hey, @michaelforgit @adasq can you suggest an edit for the changes that you experienced apart from the tutorial? I would be happy to update it on my tutorial, thanks.

@AhmedAGadir
Copy link

thank you my man

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