vue-pdf应用中跨域问题处理
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/**替换掉
更多推荐


所有评论(0)