Connect your firebase Domain to any Custom Domain
Tags: firebase, domain, customdomain, hosting
Published: 2020-12-26 08:12:25

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](console.firebase.com)
2. Select your project from the list of projects.![project list](https://dev-to-uploads.s3.amazonaws.com/i/yc86cfq4ru7an1s5f6ju.png)

3. After you click on the desired project, select the _hosting_ option from the left panel![firebase](https://dev-to-uploads.s3.amazonaws.com/i/y490m1ve3jqazs5k3hc6.png)

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](https://dev-to-uploads.s3.amazonaws.com/i/p1nv441759tqqf3fkp0r.png)

## -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](https://dev-to-uploads.s3.amazonaws.com/i/pbjr5u0isufe5ojf8ik0.png).
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](https://dev-to-uploads.s3.amazonaws.com/i/r39x3bo788emfdk8pql1.png)

* 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](https://discord.gg/8cjErAy8yA) and do checkout our website [forcommunity.tech](https://forcommunity.tech)