Pointing domain and subdomain to the same firebase app - firebase

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.

Related

Firebase Custom Domain Needs Setup - Domain.com

Here is what I completed
my website is deployed to firebase with URL https://lizart-io.web.app/
I purchased a custom domain https://lizart.io on domain.com
followed the steps from firebase documentation to set it up, these instructions were provided here: https://firebase.google.com/docs/hosting/custom-domain
verified ownership of the domain by adding two TXT records to Domain.com
Now the Error/Issue I encountered: Firebase says that my custom domain Needs Setup.
Firebase Dashboard Status
Firebase Dashboard
Domain.com DNS settings
How do I complete the last setup? Where did I miss a step?
Thank you very much in advance all!

How to redirect only subdomain to Firebase

Completely new to Firebase. Just developed a web app with Realtime DB and hosting at xxx.web.app. It works.
Now I want to host this at xxx.mydomain.com. However, DNS must be updated only for this subdomain. I have the main domain and other subdomains hosted elsewhere. Is this possible? Could you point to relevant docs how to achieve this? Thanks.
You would just need to setup the DNS for that ``xxx` subdomain to point to your Firebase hosting:
In this example I have bith www and api pointing to Firebase because I host both there. You culd just change your ``xxx` to point to Firebase.

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.

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

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.

Resources