无法从http://localhost:9000/api-docs/读取不可靠的JSON [英] Can't read swagger JSON from http://localhost:9000/api-docs/

查看:140
本文介绍了无法从http://localhost:9000/api-docs/读取不可靠的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

api-docs之前运行良好.它停止工作了,现在我得到

The api-docs was working fine earlier. It stopped working and now I get

Can't read swagger JSON from http://localhost:9000/api-docs/

如果我更改src/main/webapp/swagger-ui/index.html

If I change src/main/webapp/swagger-ui/index.html

var apiUrl = "http://localhost:8080/swagger-ui/index.html";

我得到无法从服务器读取.它可能没有适当的访问控制源设置."

I get "Can't read from server. It may not have the appropriate access-control-origin settings."

推荐答案

请参阅Jerome在上的修复程序https://github.com/jhipster/generator-jhipster/issues/277 ,方法是更改​​gruntfile.js,使其在connect/proxies部分中包含以下行

See Jerome's fix on https://github.com/jhipster/generator-jhipster/issues/277 by changing gruntfile.js to include below lines in connect/proxies section

,{
context: '/api-docs',
host: 'localhost',
port: 8080,
https: false,
changeOrigin: false
}

这篇关于无法从http://localhost:9000/api-docs/读取不可靠的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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