Fixed Adminpage in PWA Mode - 401 without asking for Username and Passwort

Masetrix

Well-known member
Affected version
2.2
If i click on "Admin", when Forum is started in PWA Mode, I only see a 404 401 Error.
 
Last edited:
I had to stop using the PWA for that reason.

Now I get the same issue whenever I try to access the ACP (on Android) and have to use incognito mode.

I think it may be a Chrome/Android bug.
 
It seems this is also related to XF2.2 in some way.

All of the sites I have issues with, the problem only started after upgrading to 2.2.
 
I also see this effect with my testsite. I have a separate, public URL but the site is protected via Basic-Auth.

During my upgrade tests there with 2.2 and PWA, I noticed that I am presented with a blank page and no auth-popup after closing Chrome window. In incognito mode it works.
 
I also have test 2.2 install with basic auth.

Also getting a 401 when trying to access it.
I need to do a hard refresh to get the username/password popup, after that it works as normal.
 
I think this is an open bug report about it:


It's not a perfect fix, but we may have to consider entirely exempting admin.php calls from the service worker fetch handler. That doesn't necessarily handle the case where the whole site is protected by HTTP basic auth, though I don't know if we can proactively detect that or handle that situation.
 
I had to stop using the PWA for that reason.

Now I get the same issue whenever I try to access the ACP (on Android) and have to use incognito mode.

I think it may be a Chrome/Android bug.
I don't think it's just Android or the PWA. I've been having, what I think, is the same problem on Windows 10. Test install with basic auth protection. If I delete the service worker for the site in chrome, the first time I go back, it asks for the username and password. Close the window and go back, 401 error without being asked for UN/PW. It's not just accessing the ACP either, it's the whole test site
 
It does also happen on Chrome/Windows but at least a hard refresh (Ctrl+F5) resolves it.

It isn't possible to do that in Android - once it starts, no amount of refreshing the page will make it work again.
 
I don't think it's just Android or the PWA. I've been having, what I think, is the same problem on Windows 10. Test install with basic auth protection. If I delete the service worker for the site in chrome, the first time I go back, it asks for the username and password. Close the window and go back, 401 error without being asked for UN/PW. It's not just accessing the ACP either, it's the whole test site
I mentioned this back when I first upgraded my dev and didn't get much response. I have just been using Chrome InPrivate mode, which gets around the problem.

 
I can confirm this problem on Microsoft Edge 85.0.564.68. Upgraded a test site with the help of a friend with an active license and got the same 401 Unauthorized access. Hard refresh (Ctrl + F5) did fix it.

EDIT: To get it to work again on Edge I had to disable Friendly URLs. I completed all the PWA information and tried turning Friendly URLs back on and got the 401 Unauthorized access error again. So for now I'm ok with my test site not using friendly URLs.
 
Last edited:
This is working again for me with multiple Android devices, so it looks like the latest Chrome update has resolved it.
 
Nope, we have started rolling out a test workaround for 2.2.1. Seems to work, though it has forced us to disable navigation preloading.
 
I think I'm going to call this fixed as part of the next release. We have made some changes to not use the service worker fetching in a few scenarios due to browser issues such as this one.

Just to note that once you upgrade, the new service worker may not be immediately loaded as browsers will check for changes on a schedule. It could potentially take 24 hours after upgrading for the change to apply.
 
Top Bottom