Hosting Firebase/Flutter app on Google subdomain - firebase

I am in the process of creating a test web app with Flutter. Is there any way to host it with firebase and have it as a subdomain of a Google domain? For example, let's say I just bought www.testsite.com through Google domains. Is there a way for me to set up webapp.testsite.com to be the firebase hosted web app?

As described in https://firebase.google.com/docs/hosting/custom-domain#expandable-1, "The host you indicate is the domain on which you want to serve content; this domain can be an apex domain or subdomain."

Related

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.

How does firebase distinguish between websites for firebase analytics?

I know that using firebase in a web app requires putting some public config keys in the front end code and that its safe to do so. But I am confused about how firebase would prevent malicious people from just copying those config keys and pasting them in their own sites and initializing the firebase analytics sdk there to try to spoil my analytics data.
In firebase auth, we also give some whitelisted domains and authentication services are only allowed on those domains by firebase. So even if we try to access those auth services from another domain, firebase won't allow it.
So how will firebase differentiate in case of analytics? If the same config keys are put in webpages on two sites abc.com and xyz.com and abc.com is my actual site whose traffic is supposed to be tracked, how will firebase know and discard data from the bad website xyz.com if the person who created xyz just copied my config from my front end code and initialized firebase.analytics() on their site to spoil my analytics?

How to change Firebase authDomain url to custom domain with DNS on cloudflare

My current project setup for a react - firebase web app is as follows.
Domain bought from godaddy
Cloudflare DNS
React web app deployed on google compute vm
Firebase for DB , Auth and functions.
I have the following entry on cloudflare DNS
A record sub.mydomain.com pointing to google cloud vm ip.
A record mydomain.com pointing to another vm ip hosting public site on google cloud compute vm.
When i use google login, the sign in page shows the myapp.firebase.com which i supposed is because my firebase configuration has authDomain=myapp.firebase.com
If i want authDomain to be my custom domain firebase asks to add another A record for mydomain.com pointing to a firebase ip.
I cannot have duplicate records pointing to different ip. Is the DNS entry required to change the authDomain or just the TXT entry (from step 2 of custom domain on firebase) is sufficient.
I do not intend to use firebase hosting.

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.

concerns about required A records for setting up Firebase Dynamic Links with a custom subdomain

In setting up our own subdomain to handle Firebase Dynamic Links using these docs, the wizard says to put the A records at example.com in our DNS. I'm getting pushback from our network administrators who are wary of creating an A record at the root of our domain, which is a large e-commerce web site.
A couple of concerns/questions about this:
The IP addresses required (151.101.1.195 and 151.101.65.195) point to non-Google servers (looks like Fastly), which is a bit alarming - it seems strange that Google would outsource their deep link hosting.
We don't want all of our e-commerce traffic (coming through example.com) to be subject to these A records. Is it possible to put the A records at link.example.com instead?
The Firebase documentation on using a custom domain for dynamic links has this note:
To use a custom domain for Dynamic Links, the domain must point to Firebase Hosting. If you have a domain you want to use with Dynamic Links and the domain points to a different host, you can either move to Firebase Hosting or create a subdomain hosted by Firebase, which you can use for Dynamic Links.
So you can indeed use a subdomain for the dynamic links. In that case, just set up the subdomain in Firebase hosting. You'll need the same TXT record as normal, to prove that you have access to the domain, but then just map the subdomain (e.g. links) for the A record.
Here is the answer I received from Firebase support about these my two concerns/questions:
Regarding Fastly, Firebase uses this subprocessor to deliver content and managed services on Firebase Hosting. For more details you could check the list of Subprocessors used by Firebase on this doc.
It's possible to use a subdomain as your Firebase project's FDL domain. You'd need to create a subdomain (link.example.com) on your domain's DNS provider and connect it to Firebase Hosting. You could check out this guide for more details.

Resources