The very best LiteSpeed Cache Varies for OpenCart if Journal 3 and LSWS is used

serpent_driver

Well-Known Member
#1
The previously recommended cache varies for LiteSpeed LScache and the cache plugin for OpenCart are no longer available because these cache varies were no longer sufficient for the current version of Journal 3. If you are looking for cache varies optimized specifically for OpenCart and Journal 3, you can get detailed information at https://www.cachecrawler.com/Downlo...iteSpeed-LScache-OpenCart-Extension::114.html about it.

***************************************************************************************************************************************************************************************************
Join https://www.cachecrawler.com - Lightning fast Cache Warmup Crawler for Wordpress, OpenCart, PrestaShop, W3 Total Cache, WP Rocket, Shopware and Magento.


***************************************************************************************************************************************************************************************************
 
Last edited:

AndreyPopov

Well-Known Member
#2
1. isDesktop - not necessary, because this is default public cache
2. isTablet - also not necessary, because exist ismobile with _lscache_vary=device:mobile cookie for mobile and _lscache_vary=device:tablet for tablet.
3. only Safari 14 or greater support webp - WebP image format | Can I use... Support tables for HTML5, CSS3, etc
4. Journal 3 has own algorithm for detection
5. chrome-lighthouse is wrong!!!! keys , because bot are next UAs:
Code:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/96.0.4664.45 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/96.0.4664.45 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/96.0.4664.45 Safari/537.36
but when you start check by Lighthouse, it use:

Code:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Safari/537.36 Chrome-Lighthouse
Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Mobile Safari/537.36 Chrome-Lighthouse
these UAs accept cookies and NOT bot!

6. wrong way use different rules for same vary :(
7. wrong way start rule from ! (NO)


right way - use _lscache_vary cookie:
PHP:
        if (($browsercheck=$this->checkBrowser()) && isset($this->lscache->setting['module_lscache_vary_safari']) && ($this->lscache->setting['module_lscache_vary_safari']=='1'))  {
            $vary['browser'] = $browsercheck;
        }



    protected function checkBrowser() {

        if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'OPR') !== FALSE) || (stripos($_SERVER['HTTP_USER_AGENT'], 'OPT') !== FALSE) || (stripos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE) ) {
            //return 'opera';
            return 'chrome';
        }

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'FxiOS') !== FALSE) || (stripos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE) ) {
            //return 'firefox';
            return 'chrome';
        }

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'Edg') !== FALSE) ) {
            //return 'edge';
            return 'chrome';
        }

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'YaBrowser') !== FALSE) ) {
            //return 'yandex';
            return 'chrome';
        }

        //if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'Lighthouse') !== FALSE) || (stripos($_SERVER['HTTP_USER_AGENT'], 'Headless') !== FALSE) ) {
        //if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'Lighthouse') !== FALSE) ) {
        //    return 'lighthouse';
        //}

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'CriOS') !== FALSE) || (stripos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE) ) {
            return 'safari';
        }

        if ( (stripos($_SERVER['HTTP_USER_AGENT'], 'Instagram') !== FALSE) ) {
            //return 'instagram';
            return 'safari';
        }
        return 'unknown';
        }
        return FALSE;
     }
 
Last edited:

AndreyPopov

Well-Known Member
#4
works, but NOT very best!!!


for example:

Code:
RewriteCond %{HTTP:sec-ch-ua-mobile} ^\?1$
RewriteCond %{HTTP:sec-ch-ua-platform} "^android$" [NC]
RewriteCond %{HTTP_USER_AGENT} "!bot|windows|linux|cros|chrome-lighthouse" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]

#1
RewriteCond %{HTTP_USER_AGENT} "android|mobile" [NC]
RewriteCond %{HTTP_USER_AGENT} "!bot|safari|iphone|ipad|chrome-lighthouse" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
this is SAME rules!!!!!
if android is present in UA - this mobile or tablet.
why you use SAME rules twice?

if android present in UA - NO!!!!!!! iphone or ipad - impossible!!!!!
if android present in UA - NO!!!!! windows - impossible!!!!!

but this is you way :(
 
Last edited:

AndreyPopov

Well-Known Member
#6
You can't say that because you would have to test it practically, which you don't have. I tested it for several days.
and what?


I not say - "they are not work".
I say - this is wrong way and many rules NOT necessary!


ONE rule!!!!! replace four you "best" rules

Apache config:
RewriteCond %{HTTP_USER_AGENT} Android [NC]
RewriteCond %{HTTP_USER_AGENT} !Bot [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
 

serpent_driver

Well-Known Member
#7
1. isDesktop - not necessary, because this is default public cache
Yes and no. The point is that I want to include every naturally user, not bots or users that simulate a natural user. I have information for this you don't have.

2. isTablet - also not necessary, because exist ismobile with _lscache_vary=device:mobile cookie for mobile and _lscache_vary=device:tablet for tablet.
If I make a device detection I make it complete and don't exclude tablets.

3. only Safari 14 or greater support webp
Yes and what is your problem?
In contrast to your cache varies, mine work because I use them correctly and not just copy them from other sources, which then cannot work because the prerequisites for them are missing.

chrome-lighthouse is wrong!!!! keys , because bot are next UAs:
You post a request that has nothing to with Lighthouse. Yours only a headless request.
 

AndreyPopov

Well-Known Member
#8
first: not need chrome-lighthouse - enough use only lighthouse
second: UA with chrome-lighthouse are NOT bot!
bots are NOT accept cookies

this is you way. but it is wrong and not in any place "best" :(

but this is your way
 

AndreyPopov

Well-Known Member
#9
this rule:

Code:
RewriteCond %{HTTP_USER_AGENT} *Version/(\d{2}).*Safari [NC]
RewriteCond %1 <=13
RewriteCond %{HTTP_USER_AGENT} "!iphone|ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "!bot|windows|linux|cros|chrome|mobile|android|chrome-lighthouse" [NC]
RewriteRule .* - [E=Cache-Control:vary=isNoWebpSafari]
for what? for old Mac and MacBook? or for what?
 

serpent_driver

Well-Known Member
#10
Lighthouse with or without chrome doesn't matter. Don't nag about unessential space here.
The lighthouse cache vary is only for guys who wants to see the very best result if they manually check their page at Pagespeed. For practical use this vary is obsolete. The same with bots. Bots should not get cached pages.

As long as you use wrong and not working cache varies you are not allowed to criticize!
 

serpent_driver

Well-Known Member
#11
this rule:

Code:
RewriteCond %{HTTP_USER_AGENT} *Version/(\d{2}).*Safari [NC]
RewriteCond %1 <=13
RewriteCond %{HTTP_USER_AGENT} "!iphone|ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "!bot|windows|linux|cros|chrome|mobile|android|chrome-lighthouse" [NC]
RewriteRule .* - [E=Cache-Control:vary=isNoWebpSafari]
for what? for old Mac and MacBook? or for what?

This is for Safari desktop users that have OS version <13 because version <13 don't support webp images
 

AndreyPopov

Well-Known Member
#13
This is for Safari users that have OS version <13 because version <13 don't support webp images.
you set NO iphone and NO ipad
you set NO windows and NO linux

what users more can use Safari?

only Mac and MacBook that use MacOS
Safari 14.0 – 15.6 has full support of WebP, but requires macOS 11 Big Sur or later.
 
Last edited:

AndreyPopov

Well-Known Member
#18
Code:
RewriteCond %{HTTP_USER_AGENT} "bot|compatible|images|cfnetwork|favicon|facebook|crawler|spider|addthis" [NC]
RewriteCond %{HTTP_USER_AGENT} !Chrome [NC]
RewriteCond %{HTTP_USER_AGENT} !Mobile [NC]
RewriteCond %{HTTP_USER_AGENT} !Macintosh [NC]
RewriteRule .* - [E=Cache-Control:vary=isBot]
RewriteCond %{HTTP_USER_AGENT} Bot [NC]
RewriteCond %{HTTP_USER_AGENT} Android [NC]
RewriteCond %{HTTP_USER_AGENT} Chrome [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobilebot]
RewriteCond %{HTTP_USER_AGENT} Macintosh [NC]
RewriteCond %{HTTP_USER_AGENT} !"Chrome|Firefox|Opera|OPR" [NC]
RewriteRule .* - [E=Cache-Control:vary=isMac]
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPad|Petal" [NC]
RewriteCond %{HTTP_USER_AGENT} !"Chrome|Firefox|Opera|OPR|CriOS|FxiOS|OPT" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobileapple]
RewriteCond %{HTTP_USER_AGENT} "Android|iPhone|iPad" [NC]
RewriteCond %{HTTP_USER_AGENT} "Chrome|Firefox|Opera|OPR|CriOS|FxiOS|OPT" [NC]
RewriteCond %{HTTP_USER_AGENT} !Bot [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
 
Top