【问题标题】:Azure APIM Policy - When to use <backend> </backend>Azure APIM 策略 - 何时使用 <backend> </backend>
【发布时间】:2024-05-20 07:30:02
【问题描述】:

https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-policies

    <policies>
  <inbound>
    <!-- statements to be applied to the request go here -->
  </inbound>
  <backend>
    <!-- statements to be applied before the request is forwarded to 
         the backend service go here -->
  </backend>
  <outbound>
    <!-- statements to be applied to the response go here -->
  </outbound>
  <on-error>
    <!-- statements to be applied if there is an error condition go here -->
  </on-error>
</policies> 

我们什么时候在政策中使用后端部分?

看起来后端 url 的设置也只在 &lt;inbound&gt; 节点上完成。

感谢您的宝贵时间。

【问题讨论】:

    标签: azure policy azure-api-management


    【解决方案1】:

    该部分用于在将请求转发到后端之前对请求进行任何转换\检查,例如,我在请求中添加标头并验证 oauth 令牌。

    【讨论】:

    • 但是您也可以在入站中完成所有这些操作,对吧?
    • 我认为你应该,不确定,太多时间没有接触 APIM