【发布时间】:2021-09-10 22:45:26
【问题描述】:
我正在尝试使用路由到 Azure 函数的 url 参数在 Azure API 管理上设置一个端点。
例如:GET my-api-gateway.azure-api.net.com/product/{productId}
我的入站策略只是设置后端并将模板参数移动到查询参数。
<inbound>
<base />
<set-query-parameter name="productId" exists-action="override">
<value>@(context.Request.MatchedParameters["productId"])</value>
</set-query-parameter>
<set-backend-service id="apim-generated-policy" backend-id="product-function" />
</inbound>
但是,当我调用 my-api-gateway.azure-api.net.com/product/123 时,/123 也会传递给后端函数 url
https://my-function.azurewebsites.net/api/product-function/123?productId=123
导致 404。
有没有办法让这个工作?
【问题讨论】:
标签: azure azure-functions azure-api-management