0

I checked the docs here: https://firebase.google.com/docs/hosting/multisites and here: https://firebase.google.com/docs/cli/targets but I don't think I understand them well enough and I am unable to host different content on different subdomains within the same domain using Firebase. E.G (page.website.com and website.com) My Firebase.json file looks like this:

{
  "hosting": [{
      "target": "mainSite",
      "public": "public"
  },
  {
      "target": "authentication",
      "public": "authentication"
  }
  ]
}

I don't really understand where to direct the folder to the subdomain using:

firebase target:apply hosting TARGET_NAME RESOURCE_IDENTIFIER

Is that RESOURCE_IDENTIFIER? E.G is website.com or whatever site what I should put into RESOURCE_IDENTIFIER? I am lost.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

I don't really understand where to direct the folder to the subdomain using:

firebase target:apply hosting TARGET_NAME RESOURCE_IDENTIFIER Is that RESOURCE_IDENTIFIER? E.G is website.com or whatever site what I should put into RESOURCE_IDENTIFIER? I am lost.

RESOURCE_IDENTIFIER refers to the SITE_ID values that you used to construct the Firebase-provisioned default subdomains for the site, see this section of the doc.

You defined them when executing the following command in the the Firebase CLI:

firebase hosting:sites:create SITE_ID

In parallel (and independently of the previous settings) you can associate a custom domain (e.g. page.website.com and website.com) to each of your site.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
  • Thank you for your response. I still don't understand what SITE_ID refers to, because in the docs it points to firebaseapp.com and the other default one, but I don't want to use either, I want to use a custom site I have added on the firebase console. If it points to my custom website, it isn't working. I used the commands it asked me to in the docs: firebase target:apply hosting mainSite easy-useful-apps.com and firebase deploy --only hosting mainSite, and the command goes through, but changes do not propagate to the website. – EspressoGuy442 Feb 08 '23 at 13:36
  • "I don't want to use either, I want to use a custom site I have added on the firebase console" In, any case the two standard hosts are mandatory for the hosting service so they cannot be deleted and you need to use them for your setup of multi sites. Then, in addition, you configure your custom domains to point to these hosts and it will be transparent for the users. – Renaud Tarnec Feb 08 '23 at 13:49
  • I don't know how to apply that. I don't plan on deleting the two standard hosts, but I don't see anything in the docs about linking them to my custom sites, or how to use them to host different content on different subdomains of the custom domain. – EspressoGuy442 Feb 08 '23 at 13:55
  • IMO you should separate the two setups. First set up the two Firebase Hosting sites as explained in the [doc](https://firebase.google.com/docs/hosting/multisites) you refer to. It is well explained and you should follow it **without taking into account that you'll configure some custom domains**. Then when the first setup is ok, just setup your custom domains as explained in the other doc. – Renaud Tarnec Feb 08 '23 at 14:46
  • With all due respect, that is what I did. My site was fully functioning off of the main sites. I then added a custom domain, and it still worked. Then I tried to separate content by subdomain, I played around in the firebase.json file, and it all broke. I read the docs, I still don't understand. That's why I posted... – EspressoGuy442 Feb 08 '23 at 18:57
  • I understand but I cannot tell you more unfortunately. If everything is broken you may start with a brand new project. – Renaud Tarnec Feb 08 '23 at 19:24