具体报错为:

在这里插入图片描述

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/**替换掉

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐