TalAter/UpUp

Using UpUp with an .htaccess authentification

LrntL opened this issue · 3 comments

LrntL commented

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
LrntL commented

In fact, after checking, it is still not working...
Seems to work with a homemade srvice worker but not with UpUp.

Any idea about using UpUp with htaccess auth ?

It should work in Chrome 77 which adds Service workers support basic HTTP authentication.

LrntL commented

Still not working. Got a blank page at first load with Chrome Version 79.0.3945.79 ((64 bits)