vue-pdf应用中跨域问题处理
vue-pdf
vue.js pdf viewer
项目地址:https://gitcode.com/gh_mirrors/vu/vue-pdf
免费下载资源
·
具体报错为:
Access to fetch at ‘http://172.27.103.7/G1/M00/00/44/rBtnB2LWJ5aAfsvXAA0Hygi9iws872.pdf’ from origin ‘http://172.27.101.43:10000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
pdf.js:26403
报错如上图所示
解决方案
nginx.conf中添加代理
location /dijz-pdf/{
proxy_pass http://172.27.103.7/;
}
前端得到的pdf路径进行修改
即dijz-pdf这一部分或者**/dijz-pdf**和斜扛之前(包括dijz-pdf)的将会被 **http://172.27.103.7/**替换掉
GitHub 加速计划 / vu / vue-pdf
2.19 K
520
下载
vue.js pdf viewer
最近提交(Master分支:24 天前 )
a9f01b23 - 6 个月前
c188a043
add open_collective vue-pdf 7 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)