hexllo 发表于 2020-11-24 10:29:13

JsViewer跨域问题,紧急求助

即使后端已经做了跨域处理,
jsviewer.openreport()方法请求时还是会报跨域错误

Access to fetch at 'http://localhost:5000/。。。。。。' from origin 'null' has been blocked by CORS policy: Request header field pragma is not allowed by Access-Control-Allow-Headers in preflight response.

我特意写了个用于测试跨域的CrosTestWebsite,证明后端跨域是处理好了的。

而位于FrontWebsite中的jsviewer却不能正常工作,

现将三个站点放上来,请求帮助。

错误重现方式:

1,用VS打开BackstageWebsite并控制台运行(不用IISEXPRESS)

2,在浏览器打开CrosTestWebsite中的test.html,可正常请求数据。

3,在浏览器打开FrontWebsite中的index.html,按F12可看到跨域请求失败。


各个站点文件请见附件。




KearneyKang 发表于 2020-11-24 10:29:14

关于跨域的问题,你可以看看这个 博客:https://gcdn.grapecity.com.cn/forum.php?mod=viewthread&tid=78237&extra=page%3D1
页: [1]
查看完整版本: JsViewer跨域问题,紧急求助