Cache Varies seem to be wrongly configured




Wordpress LScache Plugin: Cache Varies seem to be wrongly configured


As dev team knows I have developed an alternative warmup crawler that works similiar to the build-in crawler. It also uses cURL and works in parallel. For Guest Mode, WebpReplacement and Mobile the crawler needs different request parameters. For testing routine I have all settings in WP disabled that needs different cache varies. So what I found out is, that if I do requests with different parameters (Guest Mode, WebpReplacement and Mobile) they all have miss header. That is wrong. All, but not the first request must have hit header! Can you verify that? This topic was modified 7 months, 1 week ago by CacheCrawler. you may need the server debug log to check what exactly happens during cache look up process On this server where this happens I have no access to debug log. Its shared hosting. Anyway you should verify it by your own with standard WP installation and cache plugin if you run crawler with disabled settings for mobile, guest mode and webp replacement. The way I found it out is safe. With cURL I set custom header for each request and each request with different parameters like Accept header, UA and so on. In .htaccess I check with HTTP if such custom header exists and if yes I set a new header with a header value that allows me to log which request has which parameters. If all settings for webp, mobile and guest are disabled then it shouldnt matter which request has which parameters because there are no cache varies defined. For example, I define for each request 4 different parameters. That means every URL will be requested 4 times, but each request with different parameters, then if everything would be okay, only the first request must have a miss header, all other must have hit header. But it isnt okay! Each request has a miss header, although there are no cache varies defined and there are none in .htaccess. on my test it seems working as expected root@test1:# curl -I -XGET -H user-agent: Mozilla/5.0 (Macintosh Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44 -H accept-encoding: gzip, deflate, br -H accept: text/html,application/xhtml+xml,application/xml q=0.9,image/webp,image/apng, / q=0.8,application/signed-exchange v=b3 q=0.9 https://xxx/?123 HTTP/2 200 x-powered-by: PHP/8.0.17 content-type: text/html charset=UTF-8 access-control-allow-origin: link: rel=https://api.w.org/ x-litespeed-cache-control: public,max-age=604800 x-litespeed-tag: d56_HTTP.200,d56_PGSRP,d56_home,d56_URL.6666cd76f96956469e7be39d750cc7d9,d56_F,d56_,d56_MIN.5a7914aba5f369c416016e95cee3871b.css,d56_MIN.f855322286c73e5d3017c939c421882e.js etag: 314-1650540503 br x-litespeed-cache: miss content-encoding: br vary: Accept-Encoding date: Thu, 21 Apr 2022 11:28:23 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 root@test1:# curl -I -XGET -H user-agent: Mozilla/5.0 (Macintosh Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44 -H accept-encoding: gzip, deflate, br -H accept: text/html,application/xhtml+xml,application/xml q=0.9,image/apng, / q=0.8,application/signed-exchange v=b3 q=0.9 https://xxx/?123 HTTP/2 200 x-powered-by: PHP/8.0.17 content-type: text/html charset=UTF-8 access-control-allow-origin: link: rel=https://api.w.org/ etag: 314-1650540503 br x-litespeed-cache: hit content-encoding: br vary: Accept-Encoding content-length: 6147 date: Thu, 21 Apr 2022 11:28:29 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 root@test1:# curl -I -XGET -H user-agent: Mozilla/5.0 (iPhone CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Mobile/15E148 Safari/604.1 -H accept-encoding: gzip, deflate, br -H accept: text/html,application/xhtml+xml,application/xml q=0.9,image/apng, / q=0.8,application/signed-exchange v=b3 q=0.9 https://xxx/?123 HTTP/2 200 x-powered-by: PHP/8.0.17 content-type: text/html charset=UTF-8 access-control-allow-origin: link: rel=https://api.w.org/ etag: 314-1650540503 br x-litespeed-cache: hit content-encoding: br vary: Accept-Encoding content-length: 6147 date: Thu, 21 Apr 2022 11:32:14 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 Expand the first request , I added a random query to access cache miss page , that is desktop + webp , it shows cache miss , because this page has never accessed before then second request , I deliberately removed the image/webp in accept header , it now shows hit on the third request , I changed the user-agent to iPhone 15 , and it still gives hit How did you test it? With enabled/disabled settings for vary and with crawler? mobile and webp are OFF then use curl to mimic headers to access it no , didnt use crawler Okay, would you give me 1 URL of your WP installation with disabled settings for Guest Mode, no Mobile and disabled settings for webp replacement? Then I can send you log file, where you can see it. If Guest Mode is enabled a cookie is set. Does the value of this cookie matter in any way? _lscache_vary = guest_mode%3A1 What is %3A1? Escaped character P? please hit me in Slack? Done