使用反向代理部署时,反应js不提供静态文件

时间:2020-06-15 12:30:05

标签: reactjs nginx-reverse-proxy

我有一个在nginx下完美运行的reactjs应用程序。要求是使用反向代理在另一个网站下运行此应用。 我的 nginx conf 说:

    location / {
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
 proxy_pass http://127.0.0.1:3000/;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "upgrade";
 proxy_set_header X-Forwarded-Proto $scheme;

 add_header Access-Control-Allow-Origin website-2;
 add_header Access-Control-Expose-Headers Content-Length;
 add_header Access-Control-Allow-Headers Range;
 }

但是,当我尝试使用 website-2 / app 访问此文件时,会出现错误消息:

Loading failed for the <script> with source “website2/static/js/2.2c5e110e.chunk.js”

知道我想念什么吗?

谢谢

0 个答案:

没有答案