Webp wrong caching on iOS 14




Wordpress LScache Plugin: Webp wrong caching on iOS 14

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi, I used the latest LSWS & Plugin version. And sometimes, my webpages got the wrong caching version of WebP support. It returned the WebP-supported HTML version for iPhone (ios13) instead of the original JPG version (https://boidapchay.com/chay-toc-do-theo-phuong-phap-hanson/). Almost other pages returned the correct one. If I purge the cache for this URL only, everything fines again, but then it got wrong with some other pages. I do think that the marker code in htacess is not good enough (not cover all scenarios for iOS 13 & iOS 14). This topic was modified 2 years ago by alhambra81. The page I need help with: https://boidapchay.com/chay-toc-do-theo-phuong-phap-hanson/ In the crawler code, you simulate the WebP request by adding image/webp to the HTTP_ACCEPT header. Set WebP simulation @since 1.9.1 / if ( ! empty( $current_crawler[ webp ] ) ) $this->_crawler_conf[ headers ][] = Accept: image/webp, / And then in the .htaccess marker WebP support, you have this one: ### marker WEBP start ### RewriteCond % HTTP_ACCEPT image/webp [or] RewriteCond % HTTP_USER_AGENT Page Speed RewriteRule . ? [E=Cache-Control:vary=% ENV:LSCACHE_VARY_VALUE +webp] RewriteCond % HTTP_USER_AGENT iPhone. Version/( d 2 ). Safari RewriteCond %1 >13 RewriteRule . ? [E=Cache-Control:vary=% ENV:LSCACHE_VARY_VALUE +webp] ### marker WEBP end ### So in a scenario that the LS Mobile WebP crawler runs first, it will make LS Cache-Control set to vary=ismobilewebp (because of the HTTP_ACCEPT), and then when an iPhone with iOS13 request this page, it returned the wrong cached version. So I think in the second condition in .htaccess webp marker, we should set the LSCACHE_VARY_VALUE to a non WebP supported when the iOS version < 14. Hi, RewriteCond % HTTP_USER_AGENT iPhone. Version/( d 2 ). Safari RewriteCond %1 >13 iPhone comes with user agent as Mozilla/5.0 (iPhone CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1 this rule extract first 2 number after Version/ and compare if its bigger than 13 (as in 14 , 15 , 16 ?etc, 13 is not included) or I am mistaken something about this ? Best regards, The problem is, when the LS Crawler (Mobile+WebP) scan the page first, it will change the HTTP_ACCEPT to image/webp which is valid for the first condition RewriteCond % HTTP_ACCEPT image/webp [or] RewriteCond % HTTP_USER_AGENT Page Speed RewriteRule . ? [E=Cache-Control:vary=% ENV:LSCACHE_VARY_VALUE +webp] Then when an iPhone with iOS13 visit this page, it get the wrong cached version which is all the images in WebP format not JPEG so it can not render any image. Thats why I suggest the second condition should check the iOS version 13 for the above scenario (and our problem in reality ? pls check the link https://boidapchay.com/chay-toc-do-theo-phuong-phap-hanson/ in iOS 13) Hi, well , sorry I dont have iOS 13 devices now? I dont get this part iOS version 13 whats difference ? check if iOS is bigger than 13 , if so , webp it if not so, do not webp it vs check if iOS is equal or smaller than 13, if so , no webp it. if not so, webp it Best regards, @CacheCrawler When iOS 13 devices request the page after the LSCrawler WebP Mobile it will get the mobilewebp cached version which is incorrect because iOS 13 does not support Webp yet. Hi, I dont have iOS 13 devices on my hands now , its bit of difficult for me to debug such issue. was trying to use curl to mimic iOS , but didnt work out due to brotli compression I will try to get a volunteer with iOS 13 devices who can help me on this matter Best regards,



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference