IIS+ASP.NET+activeReports12+htmlviewer
报表在查看时无法预览,预览这里加载错误
会提示跨域请求的问题,
Access to XMLHttpRequest at 'https://auth.siam.sinopec.com/idp/profile/SAML2/Redirect/SSO?SAMLRequest=lVPNbhshEL5X6jsg7jYsXtUJWjta2apkqWkj2%2B0hNwKzCtIu2MAmaZ%2B%2Bw9qJLVV1lAuHmfn%2BBqhuXrqWPEGI1rsZLcac3sw%2Ff6r2haz79OjWsO8hJrJazqg1XwoxmTa8meqyKfG4EpyXDxor5vpBqCklv16ZBDKRVYw9rFxMyiUscSFGBR8VYssnUlzLko%2BvyrIo%2BeSekiXKWKfSgH5MaRclYwo9jKNVHR7O70CPte%2BYNTu2C76xLbBNfftNsDUYG0Anttn8yLJ3Kkb7BDPaqDYCJRjSRbkvZrQPTnoVbZROdRBl0jJTSPQrkTN57VuKGyCkGtyHA%2FYyENUgZOd0%2Fuo8%2FmnPPVfswHZgxu1%2BR5LV8s63Vv8mX33oVLqskSvWjJphVKagXLTgEiV12%2FrnRQCVMO829BiXHWQW3hmbbcUPhshoxNe9QQkNa7yaYHXuHVtnzfm7d1Wxt9kjMfsfc8VOnt9WdXyDYIYXiQMJXtLJ46m2aDHDGpoPpr04pqXOrFje1rc%2FEZNn8vN69sHkIP%2FKH5NccD40z%2F%2FX%2FC8%3D' (redirected from 'http://szl.sinopec.com/ActiveReports.ar12?Token=6c4d3439-8504-4ed7-b684-8a3f09011d67&Command=Export&ExportType=Html&WebViewer=true&RenderMode=Galley&Generation=1') from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
一开始在测试环境只有一台服务器,直接用http协议+IP地址访问系统,报表查看都是正常的。
然后现在报表上了正式生产环境,使用了https协议访问,系统访问使用了https,但是报表服务加载好像还是用的http, 目前尝试了两种方案
一是在IIS中添加http响应头
Access-Control-Allow-Headers Content-Type, api_key, Authorization 和 Access-Control-Allow-Origin * 二是在global Application_EndRequest中 针对 ReportService.asmx 请求添加强行替换http为https 这两种方案都不行,都不好使。
最终尝试在ReportViewer.aspx这个展示页面,head添加了<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> 这个方法对谷歌浏览器和Edge浏览器可以正常加载报表,但是对搜狗浏览器、360浏览器还是加载错误,还是提示has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
所以想请教一下各路大神,这种使用https访问系统,ActiveReport报表却仍使用http加载,导致加载错误有什么解决方法?
|