GoogleChromeLabs / sw-precache

[Deprecated] A node module to generate service worker code that will precache specific resources so they work offline.
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
Apache License 2.0
5.22k stars 388 forks source link

caching google oauth #334

Closed ghost closed 7 years ago

ghost commented 7 years ago

I`m writing single paged app using react and node as back-end. I have a trouble with google oauth and sw-precache. I don`t know how to explain what i have properly, but i`ll try.

OAuth is written with PassportJs and passport-google-oauth, so i have 2 end-points to serve OAuth and everything works fine untill i enable sw-precache. It will send me index.html instead of redirecting to google auth page.

Any ideas how to fix that?

jeffposnick commented 7 years ago

It sounds like you have navigateFallback enabled. There's a whitelist configurable via navigateFallbackWhitelist that allows you to opt-in certain URLs to this behavior.

It sounds like you want more of a blacklist than a whitelist, so you could use a negative RegExp.

Alternatively, you could migrate to Workbox, which does support both white and blacklists for its equivalent navigateFallback behavior: https://developers.google.com/web/tools/workbox/