firebasefirebase-hostingnamecheap

How to add a subdomain using Firebase and Namecheap?


I am trying to add a subdomain for my firebase app but it is not working. I've looked at Firebase site's Subdomain setup and this other SO post How do I make a custom subdomain on Firebase? but they didn't really help me.

I have a firebase app that is currently running: myawesomesite.com. I have another firebase app that I want to create the subdomain for awesome.myawesomesite.com.

I own the domain name myawesomesite.com via Namecheap. myawesomesite.com has been up for over a year.

Here is what it looks like on Firebase Hosting for the awesome app:

firebase hosting dashboard showing the google sites and custom URL that is pending

It has been showing "Needs setup" for the past 4 days.

Went I went through "Add custom domain", Firebase verified myawesomesite.com domain. Then I told Firebase that I wanted awesome.myawesomesite.com. Firebase then gave me two A Record values:

add custom domain popup

I also noticed that the A Record values for my subdomain request (awesome.myawesomesite.com), 123.456.7.890, are exactly the same A Record values for my domain myawesomesite.com.

This is what it looks like on my Namecheap dashboard:

namecheap Advanced DNS

I am pretty sure I did something wrong because Firebase give the same A Record values for both my domain (myawesomesite.com) and my subdomain (awesome.myawesomesite.com). I expected them to have different values. But Firebase gave me those values when I'm on my awesome project requesting for "Add custom domain". It has been 4 days and awesome.myawesomesite.com hasn't been active yet.

How can I correctly add a subdomain awesome.myawesomesite.com using namecheap and firebase hosting? Is this even possible on Firebase in 2021?


Solution

  • I had the same task at hand and proceeded as follows:

    1. In Firebase console, click to add a new custom domain to your hosting project and enter the subdomain with main-domain. E.g. 'sub.domain.com'.
    2. Copy the value ("google-site-verification=something").
    3. In Namecheap, go to the advanced DNS menu and add a new TXT record.
    1. Save and wait for 5~15 minutes.
    2. Back in Firebase Hosting, click to verify your domain. (If not ready yet, try again until verified). After this, Firebase gave me one A record. Not two as normally stated in the docs! Might be because it is the year 2023, or because it is a subdomain, or both.
    3. Enter this record in Namecheap.
    1. Save and wait for 1~24 hours. Your subdomain should now be verified and activated.

    *I usually saw docs and help desk entries that state, that for a subdomain, the TXT record's Host value should include the subdomain (e.g. only "sub", or "sub.domain.com", etc.), but that didn't work for me, so I changed it to "@" and got verified shortly after.