Serviceworker conflict with HTTP basic auth? Serviceworker conflict with HTTP basic auth? google-chrome google-chrome

Serviceworker conflict with HTTP basic auth?


I demoed this to one of the Google engineers responsible for implementing ServiceWorker in Chrome, and he determined that it was a Chromium bug. Filed here:

https://bugs.chromium.org/p/chromium/issues/detail?id=623464#


This is because of a fetch() option unfortunately defaults to 'omit' credentials. You need to fetch() with {'credentials': 'same-origin'}. Watch for the GitHub pull request.

For now if you are using add() or addAll() you will need to pass a request object.

Example:

cache.addAll(  cacheUrls.map(url => new Request(url, {credentials: 'same-origin'})));