I am looking into a setup where I will have servers and databases in multiple regions (data not replicated across region but independent).

The ideal flow would be:
- user make a request to api.domain.com
- proxy/load balancer determines which location contains the user data / user related data (ideally cache this against the user's session)
- proxy routes the request to location1.api.domain.com - ideally the location1.api.domain.com will be load balanced through this service too, or independently (AWS Beanstalk for example)

I am looking at HAProxy which seems to support custom routing but do you have any tips around a setup like this or some articles/examples of custom routing? If that's a good solution for this at all.

Related question advising to use HAProxy: How to configure reverse proxy/loadbalancer for custom routing


HAProxy would certainly work. I have had great luck doing this with Nginx and Lua in the past. I prefer this approach for the near infinite flexibility. Unfortunately there isn't a basic service for this type of need since you will be looking at custom data to make your routing decisions.

So, if you prefer HAProxy I say go for it. If you would like additional flexibility then go with Nginx and Lua.

  • Thanks for the reply. After more research I went with Nginx with Lua (Openresty). It does offer great flexibility and seems to be efficient for the job. – Maxime L Aug 23 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.