【发布时间】:2021-11-06 03:35:25
【问题描述】:
尝试从 localhost 与我的 Azure APIM 端点通信时,我遇到了 CORS 预检失败。我已经修改了 APIM 和 .Net Core API 本身的政策,但我仍然没有运气。以下是我的政策在 APIM 中“所有操作”部分的外观。如果有帮助的话,前端是一个角度应用程序。在 GET 上,我还在标题中附加了 ocp-apim-subscription-key。
<cors>
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods preflight-result-max-age="300">
<method>*</method>
</allowed-methods>
<allowed-headers>
<header>*</header>
</allowed-headers>
<expose-headers>
<header>*</header>
</expose-headers>
</cors>
【问题讨论】:
标签: angular azure localhost apim