[英]How to enable CORS on IIS Manager of Windows 10?
I've created an HTTPS server using IIS Manager (Windows 10).我使用 IIS 管理器(Windows 10)创建了一个 HTTPS 服务器。 Now, I want this server to support CORS requests.
现在,我希望这台服务器支持 CORS 请求。
I've read some information.我读过一些资料。 For example, this link says that I have to create a file web.config in the directory.
例如,这个链接说我必须在目录中创建一个文件 web.config。 Unfortunately, it didn't work out.
不幸的是,它没有成功。 This link says that I should edit some config files, but I don't find them on my machine.
这个链接说我应该编辑一些配置文件,但我在我的机器上找不到它们。
I had a similar issue recently.我最近遇到了类似的问题。 Most tutorial/documentation only suggests adding custom headers in the configuration.
大多数教程/文档仅建议在配置中添加自定义标头。 But this does not tell IIS to handle the CORS Pre-flight request by itself.
但这并不告诉 IIS 自己处理 CORS 预检请求。
To do so, you must install the CORS Module in IIS and add some configuration in the web.config file, as explained here: IIS CORS module Configuration Reference为此,您必须在 IIS 中安装CORS 模块并在 web.config 文件中添加一些配置,如下所述: IIS CORS 模块配置参考
I recently used this to Reverse Proxy to a REST API and handling the CORS only in IIS so that I don't have to rebuild my project to change CORS settings.我最近使用它来将代理反向到 REST API 并仅在 IIS 中处理 CORS,这样我就不必重建我的项目来更改 CORS 设置。
Try to add this into :尝试将其添加到:
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
</system.webServer>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.