Data privacy and switching servers


#1

We are being forced to have servers in France due to privacy laws, so local mongoDB, meteor server etc.

How can the client switch servers on the fly? We tried all different combinations of Meteor.connect and DDP.connect and we still can’t log in to another server.


#2

No one? Am I the only one facing this? @sashko, some direction would be appreciated if you have a moment.
I would expect international sites to want to direct to local servers to reduce latency and distribute load.

I noticed that Meteor.subscribe (and other functions) simply point to the current connection’s subscribe method. Should we just replace these functions manually or use the cumbersome approach of calling subscribe of a new DDP.connect() response?


#3

What do you mean by “switch servers on the fly”?


#4

Connect to another container running the same exact App elsewhere. E.g. we deploy in US and Europe. When a user connects, we notice they are in Europe and have the App point to the European site.


#5

Why not just connect to the same server every time? When people load the app in Europe, they can just be redirected to the european server to start with. I don’t see any reason to switch server URLs while the app client is already running in this case.


#6

So a normal web url redirect? My concern was about user experience but I guess that’s the only option.


#7

I think one redirect when the app starts isn’t a big deal, especially if you can do it server-side without loading the whole app. Many applications do a redirect to a different domain based on various factors.


#8

What do you mean server-side? Thanks


#9

You can use middlewares on Meteor’s web server, WebApp, which is based on connect: http://docs.meteor.com/packages/webapp.html

This way, you can do redirects server-side, without waiting for JavaScript to load on the client. See here for example: http://stackoverflow.com/questions/22141137/response-redirect-in-connect


#10

Understood, so you would suggest that the root of the app (i.e. /) is handled by webapp connect handler?
Which then redirects as need be.

My understanding is that you can’t have both flowrouter and webapp listen to the same path (an assumption, never validated, but makes sense).


#11

FlowRouter is implemented on top of webapp, so you can definitely use both. Maybe FlowRouter also has some server-side redirect function, never tried that.


#12

Excellent, thanks @sashko, I knew you would have the answer :slight_smile: