简体   繁体   English

Azure API 管理 - 自定义域特定 API?

[英]Azure API management - custom domain specific APIs?

I could successfully add the custom domain to the Azure API management and access the APIs.我可以成功地将自定义域添加到 Azure API 管理并访问 API。

I do understand that Azure API management supports multiple custom domains.我知道 Azure API 管理支持多个自定义域。

However all the APIs are accessible across the custom domains.但是,所有 API 都可以跨自定义域访问。

Is there any way to limit the APIs per custom domain?有没有办法限制每个自定义域的 API? Eg: API1 will be available only for the domainX while API2 is accessible for domainY.例如:API1 仅可用于 domainX,而 API2 可用于 domainY。

You could use an API level or Product level policy to return an Unauthorized status code when the Uri of the incoming call is on the wrong domain:当传入呼叫的​​ 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM