[Closed] WordPress Users Can't Login When Litespeed Cache is Active

Status
Not open for further replies.
#1
I activate LiteSpeed Cache by adding the followng lines to the .htaccess file:
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php)
RewriteRule .* - [E=Cache-Control:max-age=180]
Here are my cache settings:
Code:
Enable Cache   No
Max Object Size   Not Set
Cache Expire Time (seconds)   Not Set
Cache Stale Age (seconds)   Not Set
Cache Request with Query String   Yes
Cache Request with Cookie   Yes
Cache Response with Cookie   Yes
Ignore Request Cache-Control   Yes
Ignore Response Cache-Control   Yes
Enable Private Cache     No
Private Cache Expire Time (seconds)   Not Set
Users who have LiteSpeed Cache enabled are not able to login to their WordPress dashboards. What am I doing wrong?
 
Last edited by a moderator:

NiteWave

Administrator
#2
remove
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>
see if it works. or use CacheDisable instead of CacheEnable
 
Last edited by a moderator:
#3
remove
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>
see if it works. or use CacheDisable instead of CacheEnable

If I remove CacheEnable then the site is no longer cached. I want to use the LS cache with WordPress and have them be able to log into their dashboard.
 
Last edited by a moderator:

NiteWave

Administrator
#4
should remove it. otherwise it means cache all dynamic pages, include wp-login.php

the logic is: first disable cache for all dynamic pages, then enable individual page by "E=Cache-Control:max-age=xxx"

what's the whole .htaccess content ?
 
#5
should remove it. otherwise it means cache all dynamic pages, include wp-login.php

the logic is: first disable cache for all dynamic pages, then enable individual page by "E=Cache-Control:max-age=xxx"

what's the whole .htaccess content ?
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>


RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php)
RewriteRule .* - [E=Cache-Control:max-age=600]



# BEGIN WPSuperCache
# END WPSuperCache

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
 
Last edited by a moderator:

NiteWave

Administrator
#6
the .htaccess looks fine, except
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>
should be removed as discussed early.

If I remove CacheEnable then the site is no longer cached.
that's weird.

at this point, I have to ask you for server access to take a quick check.
you can PM lsws web admin access first, no need root ssh.
 
Last edited by a moderator:
#7
the .htaccess looks fine, except
Code:
<IfModule LiteSpeed>
CacheEnable public /
</IfModule>
should be removed as discussed early.


that's weird.

at this point, I have to ask you for server access to take a quick check.
you can PM lsws web admin access first, no need root ssh.
I removed this from the .htaccess and the console shows that pages are being cached, but when viewing the response header I don't show the litespeed cache hit:

On sites that run WP MU I can't get the cache to work at all. Here is an example .htaccess file:

Code:
<Files .htaccess>
order allow,deny
deny from all
</Files>

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php)
RewriteRule .* - [E=Cache-Control:max-age=600]

<Limit GET POST>
order allow,deny
allow from all
deny from .va1-a-cache.ono.com
deny from .brasiltelecom.net.br
deny from 68.188.
deny from 80.81.
deny from 59.95.
deny from 67.126.
deny from 61.17.
deny from 98.216.
deny from 202.156.
deny from 67.212.
deny from 6.234.
deny from 64.136.
deny from 202.89.
deny from 202.75.
deny from 121.247.
deny from 78.157.
deny from 112.203.30.
deny from 91.198.55.
</Limit>


ErrorDocument 404 http://www.google.com/
ErrorDocument 403 http://www.google.com/

<Files *.html>
ForceType application/x-httpd-php5
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
 
Last edited by a moderator:
#8
UPDATE: I have it all working now. I changed the cache configuration and I'm now seeing X-LiteSpeed-Cache:hit in the response headers and users can log into their WordPress dashboards.
 
Last edited:
#10
In the cache configuration settings I had entered values for Max Object Size, Cache Expire Time (seconds), and Cache Stale Age (seconds). When I removed those values (left the fields blank) the cache started working properly.
 

NiteWave

Administrator
#11
Maybe you have set "Max Object Size" too low ?
e.g,, if you enter 128 instead of 128KB, that means 128 bytes only, that'll cause failure to cache in most cases.
 
#14
Still having problems with this. Caching is working but when some users try any functions from within the WP dashboard they are logged out. Other users are able to complete tasks in the dashboard but can't log out. Is this a cookie issue? I tried "Cache Request with Cookie" and "Cache Response with Cookie" with yes and no values but the issue persisted.
 

NiteWave

Administrator
#15
I re-checked the rewrite rule,
RewriteCond %{REQUEST_URI} !^(wp-admin|wp-login.php|wp-cron.php)
should be
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-login.php|wp-cron.php)
i.e., missed a leading /. since (from http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html)
REQUEST_URI
The path component of the requested URI, such as "/index.html". This notably excludes the query string which is available as as its own variable named QUERY_STRING.
 
#16
the need to include a leading forward slash is often dependent upon context... eg. REQUEST_URI used <Directory> may not require the leading slash... when used in per directory context (aka .htaccess) one often must include the leading forward slash =)
 
Last edited:
Status
Not open for further replies.
Top