大摇大摆的CORS问题 [英] CORS issue with swagger

查看:118
本文介绍了大摇大摆的CORS问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正尝试在我们的svn存储库中托管api规范yml文件,该文件位于另一台服务器上。当我们从该服务器指向yml文件时,在swagger-ui中出现cors错误。

We are trying to host api spec yml file in our svn repository which is hosted on another server. When we are pointing to yml file from this server we are getting cors error in swagger-ui.

推荐答案

您需要启用 CORS 。如何执行此操作取决于您使用的服务器。该网站提供了许多服务器类型的说明: https://enable-cors.org/server.html

You need to enable CORS on the server that hosts your YAML file. How you do this depends on the server you use. This site has instructions for many server types: https://enable-cors.org/server.html

这篇关于大摇大摆的CORS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆