Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using UpUp with an .htaccess authentification #138

Open
LrntL opened this issue Jun 10, 2019 · 3 comments
Open

Using UpUp with an .htaccess authentification #138

LrntL opened this issue Jun 10, 2019 · 3 comments

Comments

@LrntL
Copy link

LrntL commented Jun 10, 2019

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
Copy link
Author

LrntL commented Jun 11, 2019

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 ?

@moneytoo
Copy link

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

@LrntL
Copy link
Author

LrntL commented Dec 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants