Provide the steps to reproduce
- Run LH on https://ondras.github.io/sw/
What is the current behavior?
start_url does not respond with a 200 when offline. The start_url did respond, but not via a service worker.
What is the expected behavior?
This configuration shall be considered okay.
The problem is related to the SW's caching strategy. The current worker works online-first, i.e. it always tries to fetch the resource. It looks like it succeeds, even when "simulating offline in Lighthouse", so the reply is not considered via a service worker.
If I change the if (cached) implementation to simply return cached (not trying any network interatction), Lighthouse works correctly.
Environment Information
- Affected Channels: DevTools
- Lighthouse version: 5.5, 5.7
- Chrome version: 79, 81
- Operating System: Linux
Provide the steps to reproduce
What is the current behavior?
start_url does not respond with a 200 when offline. The start_url did respond, but not via a service worker.What is the expected behavior?
This configuration shall be considered okay.
The problem is related to the SW's caching strategy. The current worker works online-first, i.e. it always tries to fetch the resource. It looks like it succeeds, even when "simulating offline in Lighthouse", so the reply is not considered via a service worker.
If I change the
if (cached)implementation to simplyreturn cached(not trying any network interatction), Lighthouse works correctly.Environment Information