0

in my case I have three different domains

https://www.bilal.ai (bilal.ai) <---- for showcase website firebase hosting

https://app.bilal.ai            <---- for the web app

https://api.bilal.ai            <---- for firebase functions

What I have done:

1) I have gone through this document I have connected my web app and few cloud functions such as signup function with the custom domains through rewrite hosting method in my firebase dashboard and app.bilal.ai is working perfectly as well as signup function.

Problem

1) the first domain and showcase website is a completely different project and it is on a different platform however I want all of them to be in same project if it is possible

2) so far I have seen the documents to connect custom domain to firebase hosting and functions and I have connected it for sure, but both domain is doing the same and this is a problem, for example when I goto app.bilal.ai it shows the app and when I goto api.bilal.ai it also shows the web app which is wrong, I want this domain dedicated to the backend apis which is firebase functions such as login signup function

3) similarly when someone call api.bilal.ai/login it works wit login function but if call the same api through app.bilal.ai/login it also works which is wrong i want this to show error

4) through re write method I have to write each and every function seprately in firebase.json file, I need something ** to connect all functions with custom domain and this question is also asked in a comment here

Inzamam Malik
  • 3,238
  • 3
  • 29
  • 61

1 Answers1

0

If you are on Blaze plan, you can try Firebase multisite hosting.

From the doc:

After adding domains, apply targets:

firebase target:apply hosting blog bilal-website
firebase target:apply hosting app bilal-api

Define the hosting configuration:

{
  "hosting": [ {
      "target": "website",  // "blog" is the applied target name for the Hosting site "myapp-blog"
      "public": "website/dist",  // contents of this folder are deployed to the site "myapp-blog"

      // ...
    },
    {
      "target": "api",  // "app" is the applied target name for the Hosting site "myapp-app"
      "public": "api/dist",  // contents of this folder are deployed to the site "myapp-app"

      // ...

      "rewrites": [...]  // You can define specific Hosting configurations for each site
    }
  ]
}
Can
  • 1,646
  • 9
  • 13