Reactjs 无缝部署&x2B;Nginx+;亚马逊ECS中的Docker

Reactjs 无缝部署&x2B;Nginx+;亚马逊ECS中的Docker,reactjs,docker,nginx,single-page-application,amazon-ecs,Reactjs,Docker,Nginx,Single Page Application,Amazon Ecs,当我在Amazon ECS中使用React+Nginx重新部署容器时,即使在重新加载页面后,浏览器也有一段时间(大约5-10秒)无法加载我的静态js块(在重新部署之前更改) 之后,我使用以下内容包装异步导入: //在路由文件中 常量仪表板页面=惰性(()=> 组件加载器( () => 进口( /*WebPackageChunkName:“仪表板页面”*/“页面/仪表板/仪表板页面” ), 尝试, ) //…一些代码 导出常量组件加载程序=( 懒汉:任何, attemptsLeft:numbe

当我在Amazon ECS中使用React+Nginx重新部署容器时,即使在重新加载页面后,浏览器也有一段时间(大约5-10秒)无法加载我的静态js块(在重新部署之前更改)

之后,我使用以下内容包装异步导入:


//在路由文件中
常量仪表板页面=惰性(()=>
组件加载器(
() =>
进口(
/*WebPackageChunkName:“仪表板页面”*/“页面/仪表板/仪表板页面”
),
尝试,
)
//…一些代码
导出常量组件加载程序=(
懒汉:任何,
attemptsLeft:number,
):承诺

问题是为什么第一次不允许下载此块?我希望Amazon必须立即用我的docker容器切换实例

Nginx配置:

user  nginx;
worker_processes  1;
error_log  /dev/stdout info;
pid        /var/run/nginx.pid;
events {
  worker_connections  1024;
}
http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';
  access_log  /var/log/nginx/access.log  main;
  sendfile        on;
  keepalive_timeout  65;
  proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=some_zone:10m max_size=100m
                   inactive=10m use_temp_path=off;
  proxy_cache_valid 200 3m;

  server {
    listen       9080;
    server_name  localhost;
    location / {
      root   /app;
      index  index.html;
      try_files $uri $uri/ /index.html;
    }
    location /actuator/health {
      default_type application/json;
      return 200 '{"status":"UP"}';
    }
  }
}