Browser cache not working
-
I have enabled the browser cache setting.
However I notice that the generated minified files that are served by
/min/generatedfile.css
are not sending cache control header.I have also noticed that html is not gzipped.
Can you help me?
Thanks
The page I need help with: [log in to see the link]
-
hmmmmmm, could you disable all other plugins to try ? I just installed a WP 4.8.4 with LSCWP 1.8.3 , all min/*.css are properly set cache header
Hello,
First of all i do not see litespeed cache to hit. Please check plugin settings and server settings.
I was digging in the documentation and just discoverede that openlitespeed does not support htaccess.
Is this correct?
If so, I should add all the htaccess content on rewrite section of admin panel?
Mmm…I’ve solved the htaccess problem by adding
rewriteFile /usr/local/lsws/prestitiinpdap.it/html/.htaccess
in rewrite section. Now
X-LiteSpeed-Cache: hit
is correctly sent.The question now is:
Should I add
Header set Cache-Control "max-age=31536000, public"
to my files? Or is it suppesed to be handled by litespeed cache?Here’s my htaccess file:
# BEGIN LSCACHE ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ## <IfModule LiteSpeed> RewriteEngine on CacheLookup on RewriteRule .* - [E=Cache-Control:no-autoflush] RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary] ### marker CACHE RESOURCE start ### RewriteRule LSCWP_CONTENT_FOLDER/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600] ### marker CACHE RESOURCE end ### ### marker LOGIN COOKIE start ### RewriteRule .? - [E="Cache-Vary:wp-postpass_6f658d45f2699b4444b0184733ddbf4b"] ### marker LOGIN COOKIE end ### ### marker FAVICON start ### RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400] ### marker FAVICON end ### ### marker BROWSER CACHE start ### <FilesMatch "\.(pdf|ico|svg|xml|jpg|jpeg|png|gif|webp|ogg|mp4|webm|js|css|woff|woff2|ttf|eot)(\.gz)?$"> <IfModule mod_expires.c> ExpiresActive on ExpiresByType application/pdf A2592000 ExpiresByType image/x-icon A2592000 ExpiresByType image/vnd.microsoft.icon A2592000 ExpiresByType image/svg+xml A2592000 ExpiresByType image/jpg A2592000 ExpiresByType image/jpeg A2592000 ExpiresByType image/png A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/webp A2592000 ExpiresByType video/ogg A2592000 ExpiresByType audio/ogg A2592000 ExpiresByType video/mp4 A2592000 ExpiresByType video/webm A2592000 ExpiresByType text/css A2592000 ExpiresByType text/javascript A2592000 ExpiresByType application/javascript A2592000 ExpiresByType application/x-javascript A2592000 ExpiresByType application/x-font-ttf A2592000 ExpiresByType application/x-font-woff A2592000 ExpiresByType application/font-woff A2592000 ExpiresByType application/font-woff2 A2592000 ExpiresByType application/vnd.ms-fontobject A2592000 ExpiresByType font/ttf A2592000 ExpiresByType font/woff A2592000 ExpiresByType font/woff2 A2592000 </IfModule> </FilesMatch> ### marker BROWSER CACHE end ### </IfModule> ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ## # END LSCACHE # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off # First rewrite to HTTPS: # Don't put www. here. If it is already there it will be included, if not # the subsequent rule will catch it. RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Now, rewrite any request to the wrong domain to use www. # [NC] is a case-insensitive match RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
And here’s my cache module config:
enableCache 0 enablePrivateCache 0 checkPublicCache 1 checkPrivateCache 1 qsCache 1 reqCookieCache 1 ignoreReqCacheCtrl 1 ignoreRespCacheCtrl 0 respCookieCache 1 expireInSeconds 3600 privateExpireInSeconds 3600 maxStaleAge 200 maxCacheObjSize 10000000 storagepath cachedata noCacheDomain noCacheUrl no-vary 0 addEtag 0
Further informations: if you go on https://www.prestitiinpdap.it/mutui-inpdap/ you see that image have
cache-control
but it’s not hit by litespeed cache.However css and js doesn’t have any expires header.
Seems a bug on openlitespeed. I’d like to have help on this. I can create a user and give access to check if it’s my misunderstanding of server settings or a serious bug.
Hi, @tropicalista
Thank you for all of the updates and details you’ve sent so far.
Should I add Header set Cache-Control “max-age=31536000, public” to my files? Or is it suppesed to be handled by litespeed cache?
Once you enable Browser Cache (at the bottom of LiteSpeed Cache > Settings > Cache), the headers will be taken care of for you. You don’t need to do anything else.
Further informations: if you go on https://www.prestitiinpdap.it/mutui-inpdap/ you see that image have cache-control but it’s not hit by litespeed cache.
I visited the link and I do see
x-litespeed-cache:hit
. If you don’t, it’s possible you are logged in and you have Cache Logged-In Users set toOFF
. Try viewing your page from an incognito window and see if it behaves the way you would like it to behave.Let us know if things are still not right from the incognito window, and what, specifically, is still not working.
I just noticed you’re getting some help in our main forum, so I’ll go ahead and close this post to avoid duplicate effort.
- The topic ‘Browser cache not working’ is closed to new replies.