Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple domains with the same application running firebase as the backend [duplicate]

I'm looking to build a single page application, preferably with angular on the client and firebase as the backend. As for the general data storage there are no need for advanced queries and no need for something like Mongodb along with the MEAN stack for example (which I'm most comfortable developing in otherwise). On the server side firebase has sufficient requirements for what we are looking to build. My question is and what seams to be very hard to find any information about is:

Is it possible to use **multiple domains with firebase running in the background with the same application and database for each and every domain?** (Possibly using node as a static file server alongside with it if firebase isn't enough to tackle this on its own). What I mean by this is that we want to be able to build the same system for our clients but on their separate domains.

The goal is to have a server side application running all the same backend-logic with multiple websites and with angular change the front-end components depending on what domain the user visits. (This has already been fixed and works properly with angular).

I'm not able to find any information about this other than using multiple applications with the same domain. This is not what I aim to do. And the firebase documentation isn't as much help either. The firebase hosting capabilities are the issue for me here and if anyone could point me in the right direction on where to get started it would be very much appreciated!

I've looked around for other alternatives when it comes to routing such as using vhost middlevare with the express framework or Nginx to setup some proxy of some sort but I recon that this shouldn't be necessary or at all possible to use with firebase. And I hope that there's maybe a more straigh-forward approach.

Here is an active issue on using a proxy with firebase: (Active as of now: June 2016) https://github.com/firebase/firebase-tools/issues/155

Thanks and I hope this is appropriate to ask in this forum, otherwise please do let me know where I can find more information about this.

like image 735
Anton Scotte Avatar asked Jun 15 '16 09:06

Anton Scotte


1 Answers

I eventually found out what I had to do and it now works the way I need it to. Hopefully this can help if anyone is wondering the same thing in the future.

In the firebase console you can add authorized domains by going to:

https://console.firebase.google.com/project/THE_PROJECT_ID/authentication/providers and adding the set of domains to your application. (Initially localhost and the firebase-app domain is set when creating the app)

enter image description here

and for test purposes setting the hosts in the GNU. (I'm using mac.)

sudo nano /private/etc/hosts

enter image description here

I'm now able to serve the same application on both: foo.com:5000 and bar.com:5001 just as I was looking to do from the beginning.

like image 194
Anton Scotte Avatar answered Oct 16 '22 01:10

Anton Scotte