Angry Beaver
Angry Beaver

Reputation: 465

Angular 6 ServiceWorker - index.html returned response 404 Not Found

I've deployed PWA on my test server https://wwww.mytestserver.me/dev/pwa/ under 'dev/pwa' folder. The app passed Lighthouse with 100% PWA score. But the app still doesn't work as it's expected. It just doesn't work at all. )) JS console says:

Failed to load ‘https://wwww.mytestserver.me/dev/pwa’. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘Error: Response not Ok (fetchAndCacheOnce): request for https://wwww.mytestserver.me/index.html returned response 404 Not Found’ - ngsw-worker.js:589:31

In my manifest.json I have: "scope": "/" and "start_url": "/". I tried to set them to https://wwww.mytestserver.me/dev/pwa/ and to just /dev/pwa/ but result is the same.

Upvotes: 3

Views: 4553

Answers (1)

Artem Ustimov
Artem Ustimov

Reputation: 98

You just need to change index property in your ngsw-config.json from /index.html to /dev/pwa/index.html.

If this doesn't work, you need to clean browser caches. As for me it started to work only after complete clearing of browser data.

Upvotes: 6

Related Questions