Cache always misses




Wordpress LScache Plugin: Cache always misses


Hi, I always see X-LiteSpeed-Cache: miss in the headers on the fresh plugin install with only default settings. I checked the front page, other pages, and posts using https://check.lscache.io/ . I tried the three steps in https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#cache-always-misses : 1) Disable and then re-enable (or even reinstall) LSCache doesnt help. 2) My shared hosting provider checked and said the cache directory has the proper permissions (0755). 3) I couldnt understand the recommendation about CDNs cache functions. Heres the debug log of two consecutive checks of the same page from https://check.lscache.io/ : 01/17/22 09:16:11.492 [138.197.64.167:53420 1 GgA] ------GET HTTP/1.1 (HTTPS) /about/contact/ 01/17/22 09:16:11.492 [138.197.64.167:53420 1 GgA] Query String: 01/17/22 09:16:11.988 [138.197.64.167:53420 1 GgA] [Router] get_role: 01/17/22 09:16:11.993 [138.197.64.167:53420 1 GgA] [Optm] init 01/17/22 09:16:12.097 [138.197.64.167:53420 1 GgA] [Tag] Add --- HTTP.200 01/17/22 09:16:12.097 [138.197.64.167:53420 1 GgA] [Ctrl] X Cache_control init on 01/17/22 09:16:12.182 [138.197.64.167:53420 1 GgA] [Core] Footer hook called 01/17/22 09:16:12.183 [138.197.64.167:53420 1 GgA] [Core] Footer check passed 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] [Router] get_role: 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] [Router] get_role: 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] [Vary] role id: failed, guest 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] [Router] get_role: 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] [Router] get_role: 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] X-LiteSpeed-Cache-Control: public,max-age=604800 01/17/22 09:16:12.184 [138.197.64.167:53420 1 GgA] X-LiteSpeed-Tag: b4d_HTTP.200,b4d_page,b4d_URL./about/contact/,b4d_Po.189,b4d_PGS,b4d_ 01/17/22 09:16:12.185 [138.197.64.167:53420 1 GgA] [Core] Footer check passed 01/17/22 09:16:12.185 [138.197.64.167:53420 1 GgA] [Media] finalize 01/17/22 09:16:12.185 [138.197.64.167:53420 1 GgA] [Optm] start 01/17/22 09:16:12.185 [138.197.64.167:53420 1 GgA] End response -------------------------------------------------------------------------------- 01/17/22 09:16:15.804 [138.197.64.167:53422 1 ead] ------GET HTTP/1.1 (HTTPS) /about/contact/ 01/17/22 09:16:15.804 [138.197.64.167:53422 1 ead] Query String: 01/17/22 09:16:16.798 [138.197.64.167:53422 1 ead] [Router] get_role: 01/17/22 09:16:16.804 [138.197.64.167:53422 1 ead] [Optm] init 01/17/22 09:16:16.936 [138.197.64.167:53422 1 ead] [Tag] Add --- HTTP.200 01/17/22 09:16:16.936 [138.197.64.167:53422 1 ead] [Ctrl] X Cache_control init on 01/17/22 09:16:17.037 [138.197.64.167:53422 1 ead] [Core] Footer hook called 01/17/22 09:16:17.038 [138.197.64.167:53422 1 ead] [Core] Footer check passed 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] [Router] get_role: 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] [Router] get_role: 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] [Vary] role id: failed, guest 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] [Router] get_role: 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] [Router] get_role: 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] X-LiteSpeed-Cache-Control: public,max-age=604800 01/17/22 09:16:17.040 [138.197.64.167:53422 1 ead] X-LiteSpeed-Tag: b4d_HTTP.200,b4d_page,b4d_URL./about/contact/,b4d_Po.189,b4d_PGS,b4d_ 01/17/22 09:16:17.041 [138.197.64.167:53422 1 ead] [Core] Footer check passed 01/17/22 09:16:17.041 [138.197.64.167:53422 1 ead] [Media] finalize 01/17/22 09:16:17.041 [138.197.64.167:53422 1 ead] [Optm] start 01/17/22 09:16:17.041 [138.197.64.167:53422 1 ead] End response --------------------------------------------------------------------------------Expand If it helps, https://check.lscache.io/ shows the following HTTP Header: HTTP/1.1 200 OK Connection: Keep-Alive Keep-Alive: timeout=5, max=100 x-powered-by: PHP/7.4.16 content-type: text/html charset=UTF-8 x-litespeed-cache-control: public,max-age=604800 x-litespeed-tag: b4d_HTTP.200,b4d_page,b4d_URL.9ee5f66c2a382811a8fb64e8e833f45b,b4d_Po.189,b4d_PGS,b4d_ etag: 716-1642430171 gz x-litespeed-cache: miss transfer-encoding: chunked content-encoding: gzip vary: Accept-Encoding date: Mon, 17 Jan 2022 14:36:11 GMT server: LiteSpeed alt-svc: h3=:443 ma=2592000, h3-29=:443 ma=2592000, h3-Q050=:443 ma=2592000, h3-Q046=:443 ma=2592000, h3-Q043=:443 ma=2592000, quic=:443 ma=2592000 v=43,46 This topic was modified 10 months, 1 week ago by ymf. Reason: added http header the check.lscache.io does NOT mimic real browser header please try check with real browser, see what does it show. Heres the header from Chrome (domain and IP masked). Also, Report number: RZERLXVX General Request URL: https://my-domain-name.com/about/contact/ Request Method: GET Status Code: 200 Remote Address: XXXXXXXXXXXXXXXXXXX Referrer Policy: strict-origin-when-cross-origin Response Headers alt-svc: h3=:443 ma=2592000, h3-29=:443 ma=2592000, h3-Q050=:443 ma=2592000, h3-Q046=:443 ma=2592000, h3-Q043=:443 ma=2592000, quic=:443 ma=2592000 v=43,46 content-encoding: br content-type: text/html charset=UTF-8 date: Tue, 18 Jan 2022 13:51:24 GMT etag: 1451-1642513884 br link: rel=https://api.w.org/ link: rel=alternate type=application/json link: rel=shortlink server: LiteSpeed set-cookie: vfljYt_CrPQnm=1D%2AK%40m8YpuNX%5Doy expires=Wed, 19-Jan-2022 13:51:23 GMT Max-Age=86400 path=/ secure set-cookie: VfRDnTALO=ieMPFCaTzJ expires=Wed, 19-Jan-2022 13:51:23 GMT Max-Age=86400 path=/ secure set-cookie: xowUmTsYI=F%5BTL4g1A expires=Wed, 19-Jan-2022 13:51:23 GMT Max-Age=86400 path=/ secure vary: Accept-Encoding x-litespeed-cache: miss x-litespeed-cache-control: public,max-age=604800 x-litespeed-tag: b4d_HTTP.200,b4d_page,b4d_URL.9ee5f66c2a382811a8fb64e8e833f45b,b4d_Po.189,b4d_PGS,b4d_ x-powered-by: PHP/7.4.16 Request Headers :authority: my-domain-name.com :method: GET :path: /about/contact/ :scheme: https accept: text/html,application/xhtml+xml,application/xml q=0.9,image/avif,image/webp,image/apng, / q=0.8,application/signed-exchange v=b3 q=0.9 accept-encoding: gzip, deflate, br accept-language: en-US,en q=0.9,ru q=0.8 cache-control: max-age=0 cookie: _ga=GA1.2.1629730000.1641569939 __gads=ID=30d92749b6065c39-22881d41ffcf00d8:T=1641569940:RT=1641569940:S=ALNI_MYdvHdxNegu036EY6kXrtGbGFivyQ vfljYt_CrPQnm=1D%2AK%40m8YpuNX%5Doy VfRDnTALO=ieMPFCaTzJ xowUmTsYI=F%5BTL4g1A _gid=GA1.2.1822797333.1642513105 dnt: 1 if-none-match: 1445-1642513428 br sec-ch-ua: Not A Brand v=99 , Google Chrome v=97 , Chromium v=97 sec-ch-ua-mobile: ?0 sec-ch-ua-platform: Windows sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0 WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Expand @CacheCrawler , I tried your suggestion from the old thread https://wordpress.org/support/topic/litespeed-wp-cache-plugin-always-misses/#post-12156073 specifically: 1. Addded this code into htaccess: RewriteEngine on CacheLookup on RewriteRule . - [E=cache-control:max-age=120] 2. Accessed a page on my site, it was a x-litespeed-cache: hit !3. Then removed the code from above step 1 from htaccess 4. Accessed a page on my site, it was a x-litespeed-cache: miss again . How to achieve a permanent resolution? what is your server set up ? like cPanel ? also try the debug log , enable debug log , check /wp-content/debug.purge.log , see if there is any purge call Its a shared server, I have access to cPanel. Just in case, I did [2] -> Reset all settings, then [1] -> Empty entire cache. Then I did [7] -> Clear log and [6] -> Debug log = On, Debug level = advanced. Then I did several (repeat) accesses from an anonymous (not WP-logged) Chrome window to the front page, to a certain Page, and to a certain Post. In all cases Chrome developer tool showed x-litespeed-cache: miss. Then I checked /wp-content/ directory in cPanel: /wp-content/debug.log is not empty but /wp-content/debug.purge.log is empty. please create a ticket by mail to support at litespeedtech.com with reference link to this topic we will investigate furhter. To put a closure: the LiteSpeedTech.com support found that the root case of my issue was that I have WordPress install in its own folder using Method II (With URL change): the wordpress files are in directory /home/my-acct-name/public_html/wordpress/, while the site homepage is my-domain.com without the /wordpress path. The plugins default settings doesnt handle this structure. The permanent solution to this issue is explained in the ?LiteSpeed Plugin? ?> ?Toolbox? ?> ?[3] View .htaccess? tab. Specifically, I manually added to my wp-config.php the following code to change the Frontend htaccess path: defined( LITESPEED_CFG_HTACCESS ) || define( LITESPEED_CFG_HTACCESS , /home/my-acct-name/public_html/.htaccess )