Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase hosting with multiple directories at multiple domains

Tags:

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

like image 271
Swaraj Avatar asked Apr 24 '17 07:04

Swaraj


People also ask

How many sites can I host on firebase?

Consider using automatic SDK configuration to mirror multiple environments using a single codebase. The multisite feature supports a maximum of 36 sites per Firebase project.

Can firebase hosting dynamic website?

Firebase Hosting provides fast and secure hosting for your web app, static and dynamic content, and microservices.

Is firebase good for hosting?

Firebase can be a good choice to deploy static websites, and Single Page Apps. I like to use Firebase Hosting mainly because I tested many different providers and Firebase offers an awesome speed across the continents without the need for a separate CDN on top, since the CDN is built-in for free.


2 Answers

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.

like image 196
Michael Bleigh Avatar answered Oct 02 '22 22:10

Michael Bleigh


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

like image 34
r1235613 Avatar answered Oct 02 '22 20:10

r1235613