此刻,我正在努力使用micronaut 1.2.5和远程Swagger-UI。我的想法是在一个Swagger-UI实例中收集几个API。
在micronaut项目中,我可以创建一个有效的Swagger YAML文件,并且使用此解决方案Swagger for Micronaut with maven(在项目中提供静态Swagger-UI页面),一切正常。
要让micronaut与位于我服务之外的其他域中的远程Swagger-UI一起使用,我在application.yml中进行了以下设置:
micronaut:
server:
cors:
endabled: true
configurations:
web:
exposedHeaders:
- access-control-allow-origin
- access-Control-Allow-Headers
- access-Control-Allow-Methods
不幸的是,这无济于事,Swagger-UI失败
Fetch error
NetworkError when attempting to fetch resource. https://....yml
Fetch error
Possible cross-origin (CORS) issue? The URL origin (https://aa) does not match the page (https://bb). Check the server returns the correct 'access-Control-Allow-*' headers.
在micronaut响应中,不包含access-Control-Allow标头。尽管似乎没有调用调试CorsFilter的方法,但doFilter方法中的断点没有任何作用。
有什么想法吗?
预先感谢您, 克里斯托夫