Use Azure Api Management as a passthrough

ε祈祈猫儿з 提交于 2019-12-04 10:09:28

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!