How To Use Custom Sub Domain For Your Firebase Hosting

Afrimadoni Dinata
3 min readNov 29, 2019

--

In this short tutorial I’m going to show you how to connect your subdomain with existing firebase hosting. These are the pre-requisite:

  • A static web page that has been deployed in firebase hosting
  • A domain name (and make sure you have right access to configure the DNS)
  • Cloudflare account to configure your DNS

Now please follow these step:

Connect Sub Domain

Please login to your firebase console, select project you want to configure then click on menu “Hosting”. If you already have a website then you can see Dashboard tab, from there click on “Connect Domain” button.

firebase hosting dashboard

Enter you subdomain into popup eg: test.mydomain.com then click continue. On next step you’’ll be asked to add TXT record into your DNS configuration, firebase need this to verify that you are the owner of that domain.

connect domain popup

Verify Domain Ownership

Login into your Cloudflare dashboard, select your project then click on DNS menu. Click “Add record” and then copy TXT value you got from firebase and don’t forget to save it.

configure TXT record

After saving new TXT record above go back to firebase then click “verify” button, verification process may took a few moment. Once completed you’ll see two IP addresses that you need to add into your DNS configuration, you must add both of them.

Firebase “A” DNS records

Configure IP Address

Open Cloudflare dashboard and click “Add record”, select “A” type then enter IP address you got from Firebase, it’s important to remember that you must change proxy status to DNS Only otherwise it will fail.

“A” record configuration

This changes may require sometime for Firebase to propagate, if everything configured correctly you’ll be able to see domain status as “Connected”.

firebase connected with subdomain

--

--

Afrimadoni Dinata
Afrimadoni Dinata

Written by Afrimadoni Dinata

enterprise architect. tech enthusiast. coffee addict. https://blog.rumbia.id

No responses yet