Azure APIM 作为纯代理

Azure APIM as pure proxy

我正在尝试处理后端 API(REST),没有可通过 Azure APIM 访问的 swagger 文档。 我希望所有调用都定向到后端 API,而不是手动为所有资源创建 GET/PUT/POST。我所有操作的入站政策如下 '

<policies>
  <inbound>
    <set-variable name="requestPath" value="@(context.Request.Url.Path)" />
    <base/>
    <set-backend-service base-url="https://*****/****/" />
    <rewrite-uri template="@(context.Request.Url.Path)" copy-unmatched-params="true" />
  </inbound>
  <backend>
    <base/>
  </backend>
  <outbound>
    <base/>
  </outbound>
</policies>

` 然而,当点击 APIM 时,我得到了

{ "statusCode": 404, "message": "Resource not found" } 感谢任何帮助谢谢

执行此操作的简单方法是为您支持的每个 HTTP 方法创建一个操作,并使用 /* 作为模板。这将匹配任何入站 path/query 并将其转发到后端。