Using multiple app containers - balancing / separating and forwarding cordova clients to a specific instance - experiences / thoughts?

Good news everyone,

we’re working on a (cordova) app right now. There are multiple institutions. Each client can be a customer of a one of these institutions.

So now, we want the client to connect with only “his” institution. We can figure out which institution either the first time he logs in somehow (if we use a central server / gateway) and eg. set a cookie or something (?) or let the user choose his institution from a list. I think that’s more of a design detail.

Note: We’d prefer to do all this on our own servers, not on AWS / a 3rd party distributed cloud.

BUT here are the two scenarios I can imagine we could attempt:

Option A: The Switched Cordova App
Switch the client apps’ whole configuration data about which server to use - eg. we create a separate subdomain for each institutions’ instance.

That means we try to switch the apps’ ROOT_URL etc etc at runtime, but as we’re strongly invested in cordova we have to take the whole downloading updates mechanism etc. into account. I don’t know if this is possible, preferably persistently / transparently for the client (until he logs out for example, but throughout telephone reboots, app updates etc)?

Edit: I found some example code here: Switch Cordova App Server - Example Code and I just bet my a** that we can hack it in some way… :slight_smile: But more feedback / ideas / experiences are definitely still welcome.

Option B: Reverse Proxying / Balancing to the right instance from a "central dispatch"

The other option I could imagine is using a central server / nginx or whatever, check which cookie or something is set, and dispatch to the right instance? Is that easy / hard / possible? With meteor?

Can we do this transparently? Eg. can the clients’ connection be passed through to the next meteor server after he authenticated himself? Or can we do the institution selection in the app, before the client connects to meteor?

I’m looking forward to all ideas, frameworks, packages and especially pointers and personal experience.

Thanks everyone in advance and best wishes