-
Notifications
You must be signed in to change notification settings - Fork 260
Description
Hi,
My current website is still under development. So I use an .htaccess authentication to restrict the access. Unfortunately, UpUp doesn't handle .htaccess authentication and accessing the site provide an 401 error.
After some reseach, some people (not using UpUp but hand made service worker) resolve this by using {'credentials': 'same-origin'} in fetch(), add() or addAll() methods. (See https://stackoverflow.com/a/47492920)
I change line 62 in upup.sw.js from :
return new Request(urlToPrefetch, { mode: 'no-cors' });
to:
return new Request(urlToPrefetch, { mode: 'no-cors', credentials: 'same-origin' });
And after clearing the cache, it seems to work.
If this is the correct way to make UpUp working with .htaccess authentication, maybe this option could be added in the code.
Let me know if this sounds interesting
Cheers.
Laurent.
- Version used: 1.1.0
- Browser Name and version: Chrome Version 75.0.3770.80 (Build officiel) (64 bits)
- Operating System and version (desktop or mobile): Windows 10 Pro