vite-pwa/vite-plugin-pwa

navigateFallback: "/404" causes error in service worker registration

mastercoms opened this issue · 5 comments

When /404 route is set for navigate fallback, as suggested on Astro integration docs, service worker fails to load due to error:

bad-precaching-response: The precaching request for 'http://127.0.0.1:4321/404' failed with an HTTP status of 404.

This happens on dev and deployed.

do you have a custom 404 page? https://docs.astro.build/en/basics/astro-pages/#custom-404-error-page

EDIT: you need the 404.html in the output build, otherwise you cannot use it

I have a custom page, it has 404.html in output, but it gives 404 response so I think the request fails

can you provide a minimal reproduction (Stackblitz or Githup repo)?

Sure, I will try soon

I'm going to close this for now since I'm not using an app shell model anymore, and I can't make a reproduction, maybe it was a config error / use case error anyway.