how to Routing post request to dynamic target server?

I want to perform post operation using json headers which select dynamic target endpoint by comparing header with Target endpoints header. If JSON contains header P1,P2 and two target end points has header P1,P2 and P3,P4 respectively then by comparing these headers request should be forwarded to target1.

0 1 886
1 REPLY 1

You can do it with RouteRules and conditions, or you can assign target.url dynamically.

Either way works.