React PWA not working on production on nginx server

Viewed 246

Getting following error when deploying React app with service worker on nginx server with docker, the error cause service worker to be status: redundant

enter image description here

Here is my docker config

ARG ENV
WORKDIR '/app'
COPY . .
RUN ls -la
RUN yarn install
RUN yarn build:$ENV
FROM nginx:alpine
RUN apk add --no-cache bash
RUN apk add --no-cache ca-certificates
EXPOSE 80
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html

and nginx default.conf

server {
  listen 80;
  
  location / {
    root /usr/share/nginx/html;
    index index.html index.htm;
  }

  location /healthz {
    access_log off;
    return 200 "healthy\n";
  }

  error_page 404 /index.html;
  location = /index.html {
    root /usr/share/nginx/html;
    internal;
  }
  
}

App runs fine when running ./build version locally with servo but only one deployment it shows above error and service worker no longer works.

0 Answers
Related