Affinity based on url

Is it possible to define session affinity based on a requested URL? I require that connections from multiple users, when going to the same URL, go to the same backend host.


For example:

  • If the request from cilent-1 goes to /g/{:id}
  • And the request from cilent-1 goes to /g/{:id}
  • Then both requests go to the same backend server with the same shared memory.
  • {:id} is a random id or hash and can not necessarily be pre-programmed in to a routing rule.

Not something that is supported in the current load balancing. I think ha-proxy supports this consistent hash balancing.

In my opinion it is not a great strategy. Most applications will implement some method(cache, database, message queue) to remove the need fr this request hashing.