DEV Community

Cover image for Connect your firebase Domain to any Custom Domain
stephin007 for For Community

Posted on • Edited on

Connect your firebase Domain to any Custom Domain

Firebase is a free hosting provider, through this you can deploy from simple static HTML to complex e-commerce website made on the latest tech stack.
In this post, we will look into how to connect the firebase domain to the custom domain we bought from domain providers like Namecheap, Hostinger, Google Domains, etc.

We will add another post on how to deploy any website on firebase, stay tuned :)

Assuming that you already have hosted your website on firebase, do the following steps:

- Add Domain

  1. Go to your firebase console
  2. Select your project from the list of projects.project list

  3. After you click on the desired project, select the hosting option from the left panelfirebase

  4. CLick on Add custom domain, you will see the following window, add your custom domain name in the text field provided(make sure the spelling is correct)
    adcd

-Verify domain ownership

  1. In your domain provider's site, locate the DNS management page.
    As soon as you click on continue, it will give you TXT value. This TXT value will be used by firebase to verify that you really own this domain.
    connectdoamin.
    In your domain provider's site, locate the DNS management page.
    Add this TXt value as a DNS record, you will see a bunch of options like A record, AAA record, etc. to add as a record, select TXT and then input

    • Type: TXT
    • Value: It must be the value provided by the firebase.
    • Host/Name: it should either @ or yourdomainname.com(generally it's @ - it will already be prefilled)
    • TTL Value: Keep it either Automatic or to 3600
  2. Allow up to 24 hours for the propagation of your updated TXT records, then click Verify.
    It probably takes 15-20 mins, the trick is to continue clicking verify for few mins. eventually, it will get verified.
    If clicking Verify prompts an error message, your records have not propagated or your values may be incorrect.

- Go Live

  • After your txt record gets verified, firebase will provide you with 2 A records which you have to add into your DNS Records of your domain provider by default the QUICK SETUP MODE will be selected which is suitable for new websites.arecord

  • Add A new record in your DNS Management Section, just as you added the TXT record, this time add an A Record and then input.

    • Type: A
    • Value: In this, you have to add the IP provided by Firebase, Your domain provider may list this term as "Data", "Points To", "Content", "Address", or "IP Address".
    • Host/Name: it should either @ or yourdomainname.com(generally it's @ - it will already be prefilled)
    • TTL Value: Keep it either Automatic or to 3600
  • Do the above step twice, since firebase provides you with 2 IPs to add to your DNS.

Common domain providers.

Here are some common domain providers and the types of input each might require. This information is kept up-to-date as much as possible, but refer to your domain provider's documentation for detailed instructions.

NameCheap

DNS TXT record inputs

  • Type TXT
  • Host/Name @
  • Value verification value provided in Firebase console.

DNS A records inputs

  • A @ 151.101.1.195
  • A @ 151.101.65.195

Hostinger

DNS TXT record inputs

  • Type TXT
  • Host/Name @
  • Value verification value provided in Firebase console

DNS A records inputs

  • A @ 151.101.1.195
  • A @ 151.101.65.195

Note: if in case, your domain gets not connected, it's probably due to an existing A record in your DNS Records, just delete that then you are good to go but make sure, the firebase A records are not deleted.

CloudFare

DNS TXT record inputs

  • Type TXT
  • Host/Name example.com
  • Value verification value provided in Firebase console.

DNS A records inputs

  • A example.com 151.101.1.195
  • A example.com 151.101.65.195
  • A www 151.101.1.195
  • A www 151.101.65.195

Google Domains

DNS TXT record inputs

  • Type TXT
  • Host/Name @
  • Value verification value provided in Firebase console.

DNS A records inputs

  • A @ 151.101.1.195
  • A www 151.101.1.195
  • A www 151.101.65.195

Google Cloud DNS

DNS TXT record inputs

  • Type TXT
  • Host/Name example.com
  • Value verification value provided in Firebase console.

DNS A records inputs

  • A example.com 151.101.1.195
  • A example.com 151.101.65.195
  • A www 151.101.1.195
  • A www 151.101.65.195

Squarespace

DNS TXT record inputs

  • Type TXT
  • Host/Name @
  • Value verification value provided in Firebase console.

DNS A records inputs

  • A @ 151.101.1.195
  • A @ 151.101.65.195
  • A www 151.101.1.195
  • A www 151.101.65.195

That's it for today!

Hope you liked the post, if you’ve got any questions your can Mail us mail@stephinreji.me or join our Discord-server and do checkout our website forcommunity.tech

Top comments (3)

Collapse
 
minlaxz profile image
Min Min Latt

This is a great post.
But what or how can I do if I accidentally delete TXT record from Cloudflare NS.
I have verified Cloudflare and Firebase but now I can't retrieve TXT record from firebase anymore. It is loading like this.

Collapse
 
minlaxz profile image
Min Min Latt

I got the solution. 🤓
I've visited to Google webmaster and select my domain and click Unverify then go back to the firebase hosting and regenerate my accidentally deleted TXT record and use it for verification with my DNS provider.

You can read more here Google Search Console Help for anyone who have this issue just like me.

Collapse
 
justinnn07 profile image
Justin Varghese

🔥🔥🔥