I would like to create a policy in Azure API Management that forwards all calls that start with the path \"proxy/search\" to another url. However, i don\'t want to have to i
You are making your life much harder than it needs to be. Simply create an operation that uses /proxy/*
as the template and it will match to all the URLs you identified.
Then just create a policy for that operation that does set-backend-service.
Adding to Darrel Miller's answer, here is how i got it working...
Adding an operation...
{
"name": "Search_GET",
"method": "GET",
"urlTemplate": "/search/*",
"policies": null
}
Adding a policy for that operation...
<policies>
<inbound>
<base />
<set-backend-service base-url="https://mysearchapi.com/" />
<rewrite-uri template="@(context.Request.Url.Path.Replace("search/", ""))" />
<set-header name="Api-Version" exists-action="skip">
<value>1.0</value>
</set-header>
</inbound>
<outbound>
<base />
</outbound>
</policies>