Journal3, Webp no support in Safari and LSCache

serpent_driver

Well-Known Member
#62
I cannot understand how many time need that rules in .htaccess applied.
I add rules, clear all possible caches, but ...... rules not applied after that.
what control when rules from .htaccess applied?
If you purge cache by plugin cached files will not be removed from disk and not immediately after you have pressed purge button. Cache will only be marked to be removed from disk later when system has a low workload. If you have a shared hosting with less system ressources this process can take longer to prevent highload. If you have access to CLI you can remove cached files without delay and new rules can be applied. For questions ask your provider. This is not a LSWS issue.

And btw. You use OpenLiteSpeed. This forum is for LSWS Enterprise. If you need support for OpenLiteSpeed forum https://forum.openlitespeed.org/
 
Last edited:
#67
This problem occurs when we use Litespeed plugin. we don't use the plugin because it is problematic. we are trying to increase the quality. our problems are not seen by the authorities.

Journal theme does not have any problems when we don't use the plugin.
 

serpent_driver

Well-Known Member
#68
This can't be fixed with cache rules/settings. There are too much different functions that try to detect what device is used and every function for device detection works different. To get this webp function work with LScache webp plugin must be re-developed to use Client-Side-Includes instead of pure PHP. Device detection must detect device on-the-fly with Javascript.
 

serpent_driver

Well-Known Member
#69
@cafemasasandalye

I already posted the link to a test page above. This test page simulates device detection to detect if

- Mobile or Desktop device
if Desktop
- is it a windows desktop or Apple
if Mac
- is Safari or other browser
if mobile
- is it Android or Apple
if Apple
- is Safari or other browser
....

Detection works in every case with and without cache. If device detection in webp plugin doesn't work correctly, this plugin has a malfunction, so you should contact the one who has build this plugin, but LScache plugin should also be improved.....

https://www.webp.imedes.de/
 

serpent_driver

Well-Known Member
#71
This test page is not a OpenCart installation and have developed an own plugin (hardcoded), but it doesn't matter if it is custom. The way how LScache works is always the same, but if there is a mobile view some different vary cache conditions and tags are needed. That's why I noticed cache plugin for OpenCart should also be changed for a better mobile view. The current function in cache plugin is insufficient.
 

AndreyPopov

Well-Known Member
#72
Journal theme does not have any problems when we don't use the plugin.
I think solution in next:
1. disable LSCache Mobile View option because it use

Code:
$_COOKIE['_lscache_vary'] device:mobile
$_COOKIE['_lscache_vary'] device:tablet
2. add custom rules in .htaccess like these:

Code:
### LITESPEED_CACHE_START - Do not remove this line
<IfModule LiteSpeed>
CacheLookup on
## Uncomment the following directives if you has a separate mobile view
RewriteEngine On
## no webp support for Safari begin
RewriteCond %{HTTP_USER_AGENT} "Windows" [NC]
RewriteRule .* - [E=Cache-Control:vary=isdesktop]
RewriteCond %{HTTP_USER_AGENT} "Android" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(dpi)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
RewriteCond %{HTTP_USER_AGENT} "Android" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dpi" [NC]
RewriteRule .* - [E=Cache-Control:vary=istabletandroid]
RewriteCond %{HTTP_USER_AGENT} "ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isipad]
RewriteCond %{HTTP_USER_AGENT} "ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isipadchrome]
RewriteCond %{HTTP_USER_AGENT} "iphone" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isiphone]
RewriteCond %{HTTP_USER_AGENT} "iphone" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isiphonechrome]
RewriteCond %{HTTP_USER_AGENT} "insights|lighthouse" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ispagespeeddesktop]
RewriteCond %{HTTP_USER_AGENT} "insights|lighthouse" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteRule .* - [E=Cache-Control:vary=ispagespeedmobile]
RewriteCond %{HTTP_USER_AGENT} "macintosh" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismacintosh]
RewriteCond %{HTTP_USER_AGENT} "macintosh" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(bot|insights|lighthouse)" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismacintoshchrome]
RewriteCond %{HTTP_USER_AGENT} "google" [NC]
RewriteCond %{HTTP_USER_AGENT} "bot|image" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC]
RewriteRule .* - [E=Cache-Control:isgooglebot]
RewriteCond %{HTTP_USER_AGENT} "google" [NC]
RewriteCond %{HTTP_USER_AGENT} "(bot|image)" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteRule .* - [E=Cache-Control:isgooglebotmobile]
RewriteCond %{HTTP_USER_AGENT} "yandex" [NC]
RewriteCond %{HTTP_USER_AGENT} "(bot|image)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC]
RewriteRule .* - [E=Cache-Control:isyandexbot]
RewriteCond %{HTTP_USER_AGENT} "yandex" [NC]
RewriteCond %{HTTP_USER_AGENT} "(bot|image)" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteRule .* - [E=Cache-Control:isyandexbotmobile]
RewriteCond %{HTTP_USER_AGENT} "bing" [NC]
RewriteCond %{HTTP_USER_AGENT} "(bot|image)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC]
RewriteRule .* - [E=Cache-Control:isbingbot]
RewriteCond %{HTTP_USER_AGENT} "bing" [NC]
RewriteCond %{HTTP_USER_AGENT} "(bot|image)" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteRule .* - [E=Cache-Control:isbingbotmobile]
RewriteCond %{HTTP_USER_AGENT} "(facebook|favicon)" [NC]
RewriteRule .* - [E=Cache-Control:isbots]
RewriteCond %{HTTP_USER_AGENT} "cfnetwork" [NC]
RewriteRule .* - [E=Cache-Control:iscfnetworkbot]
## no webp support for Safari end
</IfModule>
### LITESPEED_CACHE_END
then used these variables:

Code:
$_SERVER['LSCACHE_VARY_VALUE']    isdesktop
$_SERVER['LS_CACHE_CTRL']    vary=isdesktop

now testing this. but with some delays. because problems with applying rules after change .htaccess - for now after change .htaccess rules apply only 00:00 (but must 300 seconds after change)
hoster investigating openlitespeed why this happen.
 

serpent_driver

Well-Known Member
#73
These rewrite rules can't work. They have a lot of logic failures that have nothing to do with reality. They cause conflicts with effects on page load time. You loose more as you believe to win. If each rule would work, every page of your shop would get as much versions of cached page as you have defined rules. Every URL of your shop would get 20 different cached versions.
 

AndreyPopov

Well-Known Member
#74
These rewrite rules can't work. They have a lot of logic failures that have nothing to do with reality. They cause conflicts with effects on page load time. You loose more as you believe to win. If each rule would work, every page of your shop would get as much versions of cached page as you have defined rules. Every URL of your shop would get 20 different cached versions.
I test what work or what not.

because bots like Google, Bing and Yandex also use not webp images

my previous test "no-cache" was unsuccessfuilly , may be because not disable Mobile View.

later try again that reduce number of rules.
 

AndreyPopov

Well-Known Member
#75
all previous week solving with hoster problem with apply rules after .htaccess changed.
- create test site
- hoster move account to another server

hoster answer: rules in <IfModule LiteSpeed> </IfModule> applied only fullrestart OpenLiteSpeed server :(

full restart OpenLiteSpeed happens every day at 00:00 or hoster manually by my request.

---------------------------------------------------

after some testings and investigations reduce rules to these:

Code:
RewriteCond %{HTTP_USER_AGENT} "Windows" [NC]
RewriteRule .* - [E=Cache-Control:vary=isdesktopwindows]
RewriteCond %{HTTP_USER_AGENT} "Android" [NC]
RewriteCond %{HTTP_USER_AGENT} "mobile" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobilephoneandroid]
RewriteCond %{HTTP_USER_AGENT} "Android" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(mobile)" [NC]
RewriteRule .* - [E=Cache-Control:vary=istabletandroid]
RewriteCond %{HTTP_USER_AGENT} "ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isipadsafari]
RewriteCond %{HTTP_USER_AGENT} "ipad" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isipadchrome]
RewriteCond %{HTTP_USER_AGENT} "iphone" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isiphone]
RewriteCond %{HTTP_USER_AGENT} "iphone" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=isiphonechrome]
RewriteCond %{HTTP_USER_AGENT} "macintosh" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismacintoshsafari]
RewriteCond %{HTTP_USER_AGENT} "macintosh" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome|crios|opera|opt|firefox|fxios)" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismacintoshchrome]
RewriteCond %{HTTP_USER_AGENT} "(googlebot|yandexbot| yandeximages|bingbot|cfnetwork|seznambot|favicon|facebook|ccbot|ru_bot|pinterestbot)" [NC]
RewriteCond %{HTTP_USER_AGENT} "!(chrome)" [NC]
RewriteRule .* - [E=Cache-Control:isdesktopbots]
RewriteCond %{HTTP_USER_AGENT} "(yandexbot)" [NC]
RewriteCond %{HTTP_USER_AGENT} "(chrome)" [NC]
RewriteRule .* - [E=Cache-Control:isbotswebp]
they works ................. but only for home page:(
others routes not work correctly.

others routes now disabled in LSCcache module control panel.
and thinking....
 

serpent_driver

Well-Known Member
#76
hoster answer: rules in <IfModule LiteSpeed> </IfModule> applied only fullrestart OpenLiteSpeed server
A known fact of OLS, but not a hidden secret and can be found in documentation. Use LiteSpeed Enterprise for unrestricted usage.

they works ................. but only for home page
Your rewrite rules don't follow a strict logic to identify/seperate a specific device from others to make webp only available for devices that support webp image type. You don't need a rule for each kind of available UAs. Define 1 rule that is the one and only rule for Apple device identification with Safari browser. To harden this rule exclude all other UAs from this rule. In sum you only need 2 rules. Your server will thank you for it. ;)
 

AndreyPopov

Well-Known Member
#77
A known fact of OLS, but not a hidden secret and can be found in documentation. Use LiteSpeed Enterprise for unrestricted usage.
known for you.

first answer of my hoster is: rules apply after 300 seconds after .htaccess chahged
only after three days of testing hoster answer: full restart of OLS required :(



Define 1 rule that is the one and only rule for Apple device identification with Safari browser. To harden this rule exclude all other UAs from this rule. In sum you only need 2 rules. Your server will thank you for it. ;)
unfortunately impossible detect Safari browser! because all UAs contains Safari string :(

possible only detect browser is not Chrome, not Opera, not Firefox

all bots(desktop) not contain Chrome string in UA and Journal provide for they non-webp pages!
only mobile bots contain Chrome or Mobile string in UA and Journal provide pages with webp images.
 
Last edited:

serpent_driver

Well-Known Member
#78
unfortunately impossible detect Safari browser! because all UAs contains Safari string
... but only "iphone|ipad" && "Safari" is Safari without webp support, so you don't need to define extra rewrite rules for other UA and you only have to exlude other UA within the same rule.

only mobile bots contain Chrome or Mobile string in UA and Journal provide pages with webp images.
That is what I already tried to explain x-times, but you don't listen!? Device detection in Journal is PHP and it is more flexible to detect with PHP. If page is cached there is no more PHP and .htaccess isn't able to work like PHP. When will you accept that it isn't possible?

first answer of my hoster is: rules apply after 300 seconds after .htaccess chahged
only after three days of testing hoster answer: full restart of OLS required
Your hoster urns money with free code. Free code doesn't mean not to learn how free code works and what are restriction of free code. Again, if you want to have no restrictons use LiteSpeed Enterprise. A license for LSWS costs only a few ruble.
 

AndreyPopov

Well-Known Member
#79
... but only "iphone|ipad" && "Safari" is Safari without webp support
iphone|ipad|macintosh !!!!

but I also must define Mobile View for Android devices.

now with Journal I have:
1. Desktop View (Desktop Main Menu + Desktop resolution Images + Desktop Composition)
2. Retina Desktop View (Desktop Main Menu + Desktop high resolution Images + Desktop Composition)
3. Tablet View (Mobile Main Menu + Desktop resolution Images + Desktop Composition)
4. Mobile View (Mobile Main Menu + Mobile resolution Images + Mobile Composition )

and for each these view variants for non-webp

iphone use Mobile View (Mobile Main Menu + Mobile resolution Images + Mobile Composition )
ipad use Tablet View (Mobile Main Menu + Desktop resolution Images + Desktop Composition)
macintosh use Retina Desktop View (Desktop Main Menu + Desktop high resolution Images + Desktop Composition)


I cannot combine iphone and ipad because different view and images resolution.

combine Android Mobile and Tablet view - not right way also.
because LSCache load for Tablet first Mobile resolution Images from cache and then Desktop resolution Images from server :(
or vise versa first Desktop resolution Images from cache and then Mobile resolution Images from server.
 
Last edited:
#80
lscache opencart does not man.

Our server is not stable at full litespeed. needs serious support.

If the cache plugin is broken when it is not active in the theme, it is the problem of lscache.
 
Top