【发布时间】:2017-04-21 20:44:07
【问题描述】:
在 Azure API 管理中,我正在尝试修改 API 中单个路由的 CORS 策略。我遇到的问题是我不知道如何修改 BASE 策略。 Azure 似乎只是简单地用新策略覆盖它。
简单的基本政策:
<policies>
<inbound>
<cross-domain>
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>
</cross-domain>
<cors>
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods>
<method>*</method>
</allowed-methods>
<allowed-headers>
<header>*</header>
</allowed-headers>
</cors>
</inbound>
<backend>
<forward-request />
</backend>
<outbound>
</outbound>
</policies>
在具体路由中,我想修改<cors> 部分以包含更多策略,如下所示:
<policies>
<inbound>
<base />
<cors>
<expose-headers>
<header>Content-Disposition</header>
</expose-headers>
</cors>
</inbound>
</policies>
但是,Azure 想用这个覆盖基本的 CORS 策略。我在文档中找不到任何关于如何修改/合并策略而不是批量替换它的内容。
那么,我将如何继承基本策略但只添加一个额外的<expose-headers> 策略?
【问题讨论】:
标签: azure azure-api-apps azure-api-management