gpt4 book ai didi

azure - Azure 搜索服务上的 CORS 问题

转载 作者:行者123 更新时间:2023-12-02 07:38:41 25 4
gpt4 key购买 nike

我正在尝试发出 GET 请求,以便从 Azure 搜索服务查询数据。我正在尝试遵循本教程:https://www.dotnetcurry.com/microsoft-azure/cognitive-search-rest-apis-angular-app

如何允许我的域发出成功的 GET 请求而不被 CORS 策略阻止。

enter image description hereAzure 上是否有可能的方法或自定义配置来允许默认站点绕过此错误?我尝试将 API key 作为参数添加到 URL,但再次出现同样的问题。

谢谢

最佳答案

您看到此消息是因为您的浏览器阻止了前往主机 samplecognitive.search.windows.net 的请求,该主机与源 localhost 不同。您必须告诉 Azure 搜索发回包含 localhost 的“Access-Control-Allow-Origin” header 。

在 Azure 搜索服务的“概述”选项卡中,转到“索引”并单击您的索引。然后转到“CORS”。添加 http://localhost:4200 并单击“保存”。

enter image description here

关于azure - Azure 搜索服务上的 CORS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64485513/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com