How to setup domain & its sub domain to different Firebase hosting projects - firebase

Suppose my domain is mydomain.com, and subdomain subdomain.mydomain.com. I got it from Godaddy.
What I want
I want to run different websites on each.
mydomain.com -> Website 1
subdomain.mydomain.com -> Website 2
How I setup so far
Website 1 is hosted on Firebase project 1 and accessible via default URL firebase-projectid.firebaseapp.com.
Website 2 is hosted on Firebase project 2 and accessible via default URL.
Both Firebase projects are on same Google account.
What I have done successfully so far
I started with mydomain.com -> Website 1
Verified domain by adding TXT record provided by Firebase project 1.
Added couple of A records to point domain to Firebase project 1 hosting.
So far so good, and mydomain.com is working fine.
What is not working
Now I want to host subdomain.mydomain.com -> Website 2 with Firebase project 2.
I started with custom subdomain, added subdomain.mydomain.com. Firebase had already verified domain and directly provided me ip address for A records. I added both A records on my domain registrar.
As far as I understand, these are only steps needed. But subdomain.mydomain.com is not working and Firebase still shows status of subdomain as Needs Setup.
Observations
Two things I observed seems strange to me.
IP address provided by Firebase for both projects mydomain.com and subdomain.mydomain.com are same. Not sure if this is normal or not.
subdomain.mydomain.com with A records, is not propagating when checked on https://dnschecker.org/. However, if subdomain is added via Godaddy Forwarding option, then it start propagating in few minutes.
Questions
BTW, is it really possible to host domain and its subdomain on Firebase running different websites?
If yes, then is there any other step which I am missing?
Any idea why subdomain.mydomain.com is not propagating. I checked just after 10 mins. May be I need to wait longer?
Anything wrong I am doing to setup subdomain.
I tried exploring other threads but couldn't understand what I am doing wrong. Any help will be appreciated.

After scratching my head for few more hours I found issue at Godaddy side. While adding subdomain A record, I was providing host as subdomain.mydomain.com, which was wrong.
Instead of subdomain.mydomain.com host should have been subdomain only. After updating host it started propagating in few seconds, and status on Firebase is Pending. After a minute, subdomain.mydomain.com is working fine.

Related

Firebase Hosting custom domain suddenly stopped working while trying to add www redirect

I had completed setup firebase hosting custom domain after verifying TXT records and A records with IP addresses. and today I tried to add another domain to redirect www.mysite.com to mysite.com. in the process I deleted previous A records and re-added new records and firebase hosting stopped working soon after. I'm very new to firebase and I have no idea what happened. My domain is purchased from namecheap.com. I also re-added A records hoping it will fix the issue but it didn't.
it says mysite.com is connected but when I try to access it I get following error.
It started working again automatically a few minutes after resetting A records. But firebase support told me that there should only be A records with IP address in DNS configurations.

Firebase hosting multi site, 1 domain, 2 sub domains

I am building a website that has both an app and a control panel. I want the app to live at someurl.com and the control panel to be at controlpanel.someurl.com.
I have the someurl.com app setup, however the sub domain has confused me. From what I gather, the subdomain needs to be setup using the host of “controlpanel” and that it should point at a URL (e.g 115.110.145). My question is, what url should the subdomain point at, as firebase only gives me one URL.
All domains that are connected to Firebase Hosting utilize the same anycast IP addresses -- the Firebase Hosting serving infrastructure looks at the hostname of incoming requests to match to verified domains.
I'd recommend just following the steps in the docs and would reach out to Firebase support if you get stuck in a specific place.

Firebase SSL and Subdomains

So I was using Google cloud buckets to host my site, I figured out SSL Is impossible doing that so I tried app engine and that just got really complicated really fast so I tried firebase and it seems the best, however I have my main site (https://example.com) and my development build of the site with an auth login for me and my devs (https://staging.example.com). I have 2 different firebase projects one for the main site and another for the subdomain, however I first connected the subdomain one and it got an SSL cert and said connected in like 2 seconds, however I did the same for my main site and it's been stuck on pending all day now. I read somewhere that it can't do a subdomain and a normal site because of some SNI thing but if you can't enable SSL on a domain and a subdomain that's a pretty bad system imo. I use Google Domains for my domain and there are A records for the normal domain and subdomain pointing to firebase.
Thanks to anyone with any clarification.
Turns out I just had to wait for the certificate to be made, I was just confused as to why one domain took seconds to make it and the subdomain took almost a day so I thought something was wrong.

Firebase hosting with only ONE A record

I have my client's domain registered via 1and1.com
To connect the domain to the Firebase hosting, Firebase asks me to add TWO A records with 2 IPs. In 1and1 we can only add ONE A record. Yesterday Firebase sent me this message by mail
Please re-verify ownership of www.*******.com on
*******-website. The previous verification for this domain has
been invalidated. You have 1 day to re-verify ownership of
www.*******.com before it is removed from Firebase Hosting,
which will stop all content from being served from the domain. Please
visit the Firebase Hosting Panel to start the re-verification process.
Today the website was disconnected.
I reconnected the domain to the Firebase hosting through the Firebase control panel and got the website up again. But the Firebase control panel says it still needs setup
I am sure it will disconnect it again soon. How to solve that? (I already called 1and1 and they told me no way I would be able to add another A record.)
I set up in the same way a website (https://lasi17.snola.es/) and it seems to work with only one A record pointing out to the Firebase IP.
In my case, I just changed the option in Hosting -> Domains -> Your custom domain (in my case lasi17.snola.es) -> Process traffic in this domain ("Edit" under the kebab menu). After that, the domain works as usual with only one A record configured.

Pointing domain and subdomain to the same firebase app

Custom domain is currently setup with A record pointing to the IP of the firebase AND wildcard CNAME record pointing to the same app.
dig +short mydomain.com
151.101.65.75
151.101.1.75
dig +short abc.mydomain.com
myapp.firebaseapp.com.
app-cert.firebaseapp.com.
151.101.65.75
151.101.1.75
The problem is that "abc.mydomain.com" is redirecting to "mydomain.com" with a 301 response.
Is the problem in how the domain is setup or on the firebase end?
EDIT reply from the firebase support is:
"Unfortunately, since you've already connected your domain mydomain.com your firebase app, all redirects will go through that URL. and not to your firebase app.
"
This reply is so confusing and makes no sense IMO.
Update 2020-03-30
For several years now it's actually been entirely possible to have a subdomain pointing to a different Firebase Hosting site than the apex domain. This answer has been out of date. Happy Hosting!
Firebase Hosting presently only allows one canonical domain for your project -- if you specified mydomain.com and then point abc.mydomain.com to Firebase Hosting, it will redirect, as you saw.
We're considering some improvements in this area for the future, but at present all non-canonical domains will redirect.

Resources