Closed mdvanes closed 6 years ago
https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-offline uses https://github.com/GoogleChromeLabs/sw-precache
with default whitelist isPathWhitelisted(["^.*([^.]{5}|.html)$"], event.request.url)
so e.g. "https://mdworld.nl/mdworld-ingram/" is attempted to be retrieved from cache with the fallback url "https://mdworld.nl/offline-plugin-app-shell-fallback/index.html"
The 404 page can be either briefly seen, or it gets stuck in a loop. Instead, the cache should be skipped completely, i.e. "https://mdworld.nl/mdworld-ingram/" should not match the whitelist regexp.
https://regex101.com/r/BA2s0Y/1
^.*([^.]{5}|.html)$
matches https://mdworld.nl/mdworld-ingram/
and does not match https://mdworld.nl/mdworld-ingram/foo.js
(as intended by the default config).
This should work: (?=^.*([^.]{5}|.html)$)(?=^(?!https:\/\/mdworld\.nl\/mdworld-ingram\/).*$)
adding more exceptions (AND NOT) like: (?=^.*([^.]{5}|.html)$)(?=^(?!https:\/\/mdworld\.nl\/mdworld-ingram\/).*$)(?=^(?!https:\/\/mdworld\.nl\/mdworld-simon\/).*$)
Load https://mdvanes.github.io/mdworld-simon/ sometimes gets in a 404 reload loop. Stop and go back and correctly loads: https://mdworld.nl/mdworld-simon/
Not tested if this also happens when directly opening https://mdworld.nl/mdworld-simon/