I have a use case to route the request based on incoming url
where in API URL suffix - apples/grapes
Case 1: suppose an incoming request is
https://fruits.com/apples/grapes/rest
then I need to divert the request to backend url say: https://stores.com/a/g
I am able to achieve this by adding <rewrite-uri template="/"/? to inbound policy
Case 2:
suppose if the incoming request is
https://fruits.com/apples/grapes/rest/a/b
then I need to route the request to the backend url: https://stores.com/a/g/caps/locks
I am able to achieve this by adding <rewrite-uri template="@(context.Request.Url.Path.Replace("rest/", ""))" /> to inbound policy
How do I achieve both the use-cases in the same operation? as the response would be different for both cases;
I am unable to filter the incoming request based on context.api.path; when I send the request for the first usecase I am getting 500: internal server error as apim is expecting url path after rest/