How can the request be directed according to a dynamic list

Hi ,I am a newer. I hope somebody can give me some advice.

I want to give some change to the nginx_upstream_hash_ module. I need a
special function. I have a dynamic list with some uri and flags , like

Uri flag
/web1.jsp server1
/web2.jsp server2
/web3.jsp server1

The requests can be directed to the backend according to this list.

How can I do?