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

serpent_driver

Well-Known Member
#42
It is only possible to reproduce the bug to a limited extent because it would require an infinite number of different (real) devices. The problem with @Lee's shop is that the cache is inexplicably purged. This purging can be provoked by switching between the views with the Firefox browser and the functions for the simulated view with different UAs. The cache is purged with every change, and you have to wait a few minutes between changes.
 

AndreyPopov

Well-Known Member
#43
This purging can be provoked by switching between the views with the Firefox browser and the functions for the simulated view with different UAs.
simulated view? check in developer mode with device emulation in Firefox?

like for me, Firefox used by 0.06 % of users of my site
lscache_firefox.jpg

in last build of Journal https://docs.journal-theme.com/changelog
also made compatibility with Firefox
Fixed form input max-width in Firefox
may be some incompatibility between Journal3 and Firefox still exist, but I'm not worry about it.
 

serpent_driver

Well-Known Member
#44
simulated view? check in developer mode with device emulation in Firefox?
Yes.

like for me, Firefox used by 0.06 % of users of my site
It is only to simulate. It doesn't matter how much users of your page use FF.

may be some incompatibility between Journal3 and Firefox still exist, but I'm not worry about it.
This issue is regardless which browser is used if the server purges the cache.
 

AndreyPopov

Well-Known Member
#48
if I know, lscache can purged by:
- physical way: delete lscache files (folder)
- physical way: delete cacheman.shm file (cache index file)
- logical way: by purge header ALL (clear index file) or url (clear url link in index)

also I know that
LSWS make difference between PURGE and REFRESH command in curl
OLS accept REFRESH like PURGE
 
Last edited:

serpent_driver

Well-Known Member
#49
The crazy thing is that only the cache of a requested URL is purged if you change the simulated view in browser and not the entire cache. LSWS or LScache doesn't care of the browser. It only checks headers and the UA, although UA is a header.
 

AndreyPopov

Well-Known Member
#54
@AndreyPopov

Where does this cookie come from? Is it generated by cache extension or by your custom code?
_lscache_vary: browser%3Asafari%2Cdevice%3Atablet

PHP:
_lscache_vary: browser%3Asafari%2Cdevice%3Atablet
this add extension

device:mobile - for phone
device:tablet - for tablet

and
browser:safari - for Safari browser

but ......
I also add custom code. my custom code in this case add:
_lscache_vary: apple%3Aipad%2Cbrowser%3Asafari%2Cdevice%3Atablet ;)



PHP:
    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;
     }


    protected function checkApple() {

        if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'Macintosh') !== FALSE) {
            return 'macintosh';
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== FALSE) {
            return 'iphone';
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== FALSE) {
            return 'ipad';
        }
        }
        return FALSE;
    }


    protected function checkOS() {

        if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== FALSE) {
            return 'windows';
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'Linux') !== FALSE) {
            return 'linux';
        }
        }
        return FALSE;
    }
 

AndreyPopov

Well-Known Member
#56
This doesn't answer my question or I don't understand your answer. Is this cookie custom set by your code?
no.

this cookie (in this form):
PHP:
_lscache_vary: browser%3Asafari%2Cdevice%3Atablet
sets extension by default (for iPad).

https://github.com/litespeedtech/ls...talog/controller/extension/module/lscache.php

PHP:
 protected function checkVary()





P.S. repeat - my custom code add for this case:
PHP:
_lscache_vary: apple%3Aipad%2Cbrowser%3Asafari%2Cdevice%3Atablet




P.S.P.S. default internal crawler NOT add this cookie while recache and that's why internal crawler cannot create cache for iPhone/iPad devices.
 
Last edited:

serpent_driver

Well-Known Member
#58
@AndreyPopov

I have updated the extension and now I also get this cookie. With this extension I tried to reproduce the phenomenon purging the cache with FF simulated view function and surprise the cache is not purged. The question now is if this only happens with your custom code? Where I can I find your custom code to extend detection and this cookie?
 

AndreyPopov

Well-Known Member
#60
this is you try?


Code:
2022-09-16 7:03:19 - PHP Warning:  mysqli::query(): MySQL server has gone away in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
2022-09-16 7:03:19 - PHP Warning:  mysqli::query(): Error reading result set's header in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
2022-09-16 10:55:09 - PHP Warning:  mysqli::query(): MySQL server has gone away in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
2022-09-16 10:55:09 - PHP Warning:  mysqli::query(): Error reading result set's header in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
2022-09-16 16:05:24 - PHP Warning:  mysqli::query(): MySQL server has gone away in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
2022-09-16 16:05:24 - PHP Warning:  mysqli::query(): Error reading result set's header in /home/priazhas/priazha-shop.com/www/system/library/db/mysqli_memcached.php on line 123
 
Top