We have a slightly irregular web server: it serves user details based on the user's IP address. The user details are stored in several databases; each database stores information about a subset of users. Users have data in only one database. There is one master database which tells you where each user can be found.
Due to external factors, the web server has to be replaced by a dedicated machine for each database. It would be easy to set up a reverse proxy that splits requests between servers. However, the decision which server to forward the request to depends on the entry in the master database.
Is there a reverse proxy server that allows a script to decide which back-end server gets to handle a particular request?