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/**替换掉
vue.js pdf viewer
最近提交(Master分支:2 个月前 )
a9f01b23 - 1 年前
c188a043
add open_collective vue-pdf 1 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)