4

I have an application where the URL of a request determines which server to forward the request to based on a memcache or database lookup. Currently, it is just round robin, but the state is only stored on one server and that server needs to get all requests with a certain field. So I want to achieve something like the following table:

  • /Objects/ABC/ -> Lookup ABC in memcache, returns servera.local -> Server A
  • /Objects/DEF/ -> Lookup DEF in memcache, returns serverb.local -> Server B

Is this possible with HAProxy? If not, what else can I use? I really don't want to duplicate the request from Server A to Server B if Server A got the request but Server B is responsible for it.

Another solution that might work for me, is if the application can return something that tells HAProxy which host to resend the request to.

Matt Williamson
  • 323
  • 2
  • 4
  • 10

1 Answers1

0

This goes in the frontend

acl use_backend1 path_reg ^/Objects/ABC/$
acl use_backend2 path_reg ^/Objects/DEF/$
use_backend backend1 if backend1
use_backend backend2 if backend2
default_backend normal_backend

backend backend1
    ....

backend backend2
    .... 

backend normal_backend
    ....

Something along those lines

Mike
  • 22,310
  • 7
  • 56
  • 79