Problem with htaccess & htpasswd with litespeed 5.1.17 & 5.2

track1

Well-Known Member
#1
I have some standard htaccess password protected dirs.

It works ok with litespeed 5.0.8, but after upgrading to 5.1.17 or 5.2, it doesn't work (is strange because sometimes it works..)
Sometimes i get 401 (UNAUTHORIZED) error and others works ok.
 

NiteWave

Administrator
#2
yes, it's hard to trouble shoot the issue if it's hard to reproduce it first.

if you encounter 401, mean it works ?
if no prompt to ask for user/password, it's possible it's cached in browser.
so try in another browser or clear the browser cache and see if the window will pop up ?
 

track1

Well-Known Member
#3
It's not related with browser cache.
Sometimes works, sometimes not. I did cache clear, new browser, etc, with random results.

5.0.8 Always works, 0 errors, 0 blank pages.
5.1.17 or 5.2, random. It use to work sometimes after litespeed restart, then page loads are 401 with blank page.

Browser log: [[Failed to load resource: the server responded with a status of 401 (Unauthorized)]]
Server log: 401 0...

It's like litespeed doesn't read user/pass always from browser, although browser prompt for it or send by cache.

There is some new feature between 5.0.x versions that can produce this?
 
Last edited:

track1

Well-Known Member
#4
I have found is a problem related to litespeed cache.
Removing these cache lines from root dir .htaccess it always works:

Code:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^HEAD|GET|PURGE|REFRESH$
RewriteCond %{REQUEST_URI} !^/foro/(login|register|cron)\.php$
RewriteRule .* - [E=Cache-Control:private,L]
 
Last edited by a moderator:

NiteWave

Administrator
#5
great, I think that's the reason.
any reason you use private cache ? let us know the scenario.
should it be better if remove "private" from above rules?
 
Top