23

I have the following setup and wanted to know how to best configure Firebase hosting

I have a repo with the /build directory with three subdirectories:

  • /build/a
  • /build/b
  • /build/c

I'd like to serve each directory at its own domain (or domain) in both prod and dev like:

  • /a
    • Prod: foo.com and www.foo.com
    • Dev: dev.foo.com
  • /b
    • Prod: b.foo.com
    • Dev: b.dev.foo.com
  • /c
    • Prod: c.foo.com
    • Dev: c.dev.foo.com

It seems like the only way to do this is to create a separate Firebase project for each deployed directory (6 total), with a separate firebase.json for each directory (3 total)

Is there a better way to do this?

Thanks

Swaraj
  • 1,235
  • 1
  • 13
  • 22
  • Multiple domains and sub-domains support added. https://groups.google.com/forum/#!msg/firebase-talk/iFyES5bbP-8/MW5opAiDBAAJ – Kishore Aug 08 '18 at 09:06

2 Answers2

24

This would require setting up six projects (one for each prod/dev environment) and three firebase.json files. You can associate multiple domains with a single site, but at present you cannot have multiple sites in the same project. This is something that we're looking into supporting in the future, but there's nothing to announce at this time.

Michael Bleigh
  • 25,334
  • 2
  • 79
  • 85
  • 4
    This would be incredibly useful. – jdscolam Sep 04 '17 at 06:00
  • 2
    It would be great if Firebase could support a separate landing page and a page for your app as well as dev environments, that would be really helpful. – DevShadow Dec 23 '17 at 13:33
  • 7
    Now, that nearly a year has passed, I was wondering whether there is a new solution to this problem? I am having the same issues with my curent project. – Martin Reiche Apr 13 '18 at 14:47
11

You can host multiple site on Firebase now.
https://firebase.google.com/docs/hosting/multisites?authuser=0

r1235613
  • 111
  • 1
  • 3