【问题标题】:Azure API management - custom domain specific APIs?Azure API 管理 - 自定义域特定 API?
【发布时间】:2020-10-02 15:01:46
【问题描述】:

我可以成功地将自定义域添加到 Azure API 管理并访问 API。

我确实了解 Azure API 管理支持多个自定义域。

但是,所有 API 都可以跨自定义域访问。

有没有办法限制每个自定义域的 API?例如:API1 仅适用于 domainX,而 API2 可用于 domainY。

【问题讨论】:

    标签: azure azure-api-management


    【解决方案1】:

    当传入呼叫的​​ Uri 位于错误的域中时,您可以使用 API 级别或产品级别策略返回未授权状态代码:

    <policies>
      <inbound>
        <base />
        <choose>
          <when condition="@(context.Request.OriginalUrl.Host != "domainX")">
            <return-response>
              <set-status code="401" reason="Unauthorized"/>
            </return-response>
          </when>
        </choose>
      </inbound>
    </policies>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-27
      • 1970-01-01
      • 2021-10-20
      • 1970-01-01
      • 1970-01-01
      • 2021-11-18
      • 2021-01-22
      相关资源
      最近更新 更多