Here I have an interesting case I recently knew about. Let's say a small software shop creates mobile and web apps that make requests to a web service. The software is sold to single users and also to third party companies. Initially all users made requests to this single endpoint, but then some client companies demanded to host their own server and database instances in their own servers.
At the beginning these companies were the exception, so a custom copy of the app was compiled with their custom URL, while the regular version of the app used the original URL. But this soon turned out to be unmaintenable as the number of such companies grew and releases of the client app became more frequent.
So there is now a first ws (hosted by the developers) with a user database that contains the actual service URL each user would need to connect to, and there's a single version of the client app that everyone uses and is compiled with the first WS's fixed URL. When a user logs in, the app makes an http request to retrieve the final WS URL for the user. This second URL will be different depending on whether the user needs to use the in-house hosted WS or it belongs to a self-hosting client organisation. From that point on the app uses that URL for subsequent requests. This is nice for managing companies, as you can for instance quickly cut the service to a company that does not pay, but on the other hand it generates too much traffic to the first server.
How would you solve this in 2016? I'm not a sysadmin or network expert, but it looks to me this is a handcrafted solution to a routing problem, and the first server can be replaced with something else. All it is needed to determine the WS URL is the user's organization name. The final server side software is the same and the databases are similar. Maybe this could be solved with a load balancer? I know Amazon EC2 and Azure support load balancing, but here we are talking about redirecting to dedicated servers each one different and hosted by third party companies. Maybe something could be done with DNSs?
UPDATE
Looks like a reverse proxy can do the job (nginx?). How would you route to each backend based on the organizations name?
0 Answers