Pointing a subdomain to Firebase functions - firebase

I've got a website hosted on firebase www.example.com. I'd like to serve some functions in the same project from api.example.com.
Rewrites seem to only support directories and not subdomains though. Has anyone been able to accomplish this? Do I have to just use two different firebase projects?

Rewrites won't handle domain names directly. As you say, you can use a second project, and route calls to your API via your custom domain using Firebase Hosting integration with Cloud Functions.

Related

Subdomaining in Firebase Hosting

I have a Firebase project with Hosting enabled. My default url (given by Firebase) is
<PROJECT_NAME>.web.app. How can I also deploy to dashboard.<PROJECT_NAME>.web.app? I want authenticated users to be able to see this special dashboard.<PROJECT_NAME>.web.app url.
Whenever I try adding this as a custom domain, Firebase asks me to add some stuff regarding to web.app, which I can't.
Note: I am using React for my project.
You don't get any control over the web.app subdomain that's automatically created for your project. That is entirely managed by Google. If you want to customize a domain, you will have to register one of your own and manage its DNS for use with Firebase Hosting as described in the documentation.

Can I have two domains for one website (Firebase)?

I have developed a Flutter website and use Firebase for my storage and hosting. Now I want to use two domains "www.mywebsite.de" and "www.mywebsite.fr". Can I do this with Firebase?
Yes, you can configure multiple custom domains for a single Firebase Hosting project. In fact this is quite common.
Just keep in mind that all domains will be serving the exact same content, unless you also set up multiple sites on the Firebase project.
So given your use-case, you may either serve the same resources to French and German users, or you can configure a separate site for each in the same project, and then serve different resources to French and German users.

Firebase complex custom domain for functions

I have my website site.com hosted on Firebase Hosting and a simple API on Firebase Cloud Functions.
Right now the API can be accessed on https://us-central1-SITE.cloudfunctions.net/
I know that I can use firebase.json to rewrite the function URL to my custom domain and do something like site.com/api-function-name.
Is there a way to redirect the API URL to a custom subdomain and keep the main domain only for the website hosting?
So I'm trying to make:
api.site.com => access API functions
site.com => access website content
Yes, that is possible. Your api.site.com and site.com will be two separate sites, that are part of the same Firebase project.
See the Firebase documentation on adding additional sites and setting up deploy targets for your sites.

Are wildcards allowed in the FirebaseDynamicLinksCustomDomains plist when using a custom domain in firebase dynamic links?

I am setting up dynamic links with custom domains using firebase for unity. In the documentation here, https://firebase.google.com/docs/dynamic-links/ios/receive#open-dynamic-links-in-your-app, I can see that I need to add plist entries to the FirebaseDynamicLinksCustomDomains
key to whitelist these domains in my app.
My question is if I can use a wildcard subdomain here, as my setup includes dozens of custom subdomains, some of which may be created after the app has shipped.
FirebaseDynamicLinksCustomDomains
https://*.firebaselinks.example.com/links/
Will this work to allow opening the app from any subdomain on firebaselinks.example.com ?

Can I use a wildcard subdomain with my custom domain?

Just checking to see if anyone knows if this is possible yet. I would like to use a wildcard subdomain with firebase hosting and use functions to parse the subdomain.
No, Firebase Hosting does not presently support wildcard subdomains. It's something that we'd like to do in the future, but there are no timelines or concrete plans to share at this time.

Resources