OpenCart LS Module Scroll Mobile Issue

AndreyPopov

Well-Known Member
#3
On many of our OpenCart installations our clients (and myself) are having issues with scrolling on mobile devices..
When enabling the module - after time - scrolling isn't possible anymore until we purge all caches..
This is a repeating problem on multiple sites..
what Opencart version?
LSWS(LiteSpeed Web Server) or OLS (OpenLiteSpeed)?
PHP version? LSCache plugin version?
native Opencart or modified Opencart build like ocStore?
is third Opencart theme installed?
are different desktop and mobile views?
are in .htaccess present rewrite rules with L flag?

P.S. exist Opencart thread for LSCache https://www.litespeedtech.com/support/forum/forums/litespeed-cache-extension-for-opencart.46/
 
Last edited:

Lee

Well-Known Member
#4
I had the same issue and the fix for me is stupid and time consuming but it works.

After clearing the cache, I have to visit every page in the menu with my iPhone to create the cache. If I use a PC first or using the Terminal, it will cause some pages on mobile devices to not scroll. Once I do this I then rebuild the rest of the cache with the terminal in cPanel using this command - curl -N "your domain name here/index.php?route=extension/module/lscache/recache&from=cli"
 

AndreyPopov

Well-Known Member
#5
I had the same issue and the fix for me is stupid and time consuming but it works.

After clearing the cache, I have to visit every page in the menu with my iPhone to create the cache. If I use a PC first or using the Terminal, it will cause some pages on mobile devices to not scroll. Once I do this I then rebuild the rest of the cache with the terminal in cPanel using this command - curl -N "your domain name here/index.php?route=extension/module/lscache/recache&from=cli"
first you need Enable - Separate Mobile View in plugin GUI settings and UNCOMMENT in .htaccess lscache rewrite rules
 

AndreyPopov

Well-Known Member
#7
if you site have webp images than you must enable Enable Separate View for Safari and .htaccess rewrite rules

and make recache for separate User Agent for iPhone and Desktop
 
Last edited:

AndreyPopov

Well-Known Member
#9
also check that all lscache rewrite rules placed before others rules with L flag.

I'm not sure how to do this "make recache for separate User Agent fir iPhone and Desktop"
in LSCache plugin GUI present "Rebuild Cache for specific devices/browsers" field.
paste one. two three or more User Agents for what you need make recache

for example iPhone UA:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1

Android phone UA:
Mozilla/5.0 (Linux; Android 7.1.2; SM-G955F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Mobile Safari/537.36

Windows desktop UA:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ 98.0.4758.82 Safari/537.36
 
Last edited:

Lee

Well-Known Member
#10
Thank you for this information, never knew about.

Boy it sure SLOWS down the recache, it's going to take hours now...
 

Lee

Well-Known Member
#12
Question: Can you use wildcards to match any version of chrome or safari?

Example:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/*

Also, I went to whatsmybrowser . com and the first line is what it returns for my cell phone. I entered that in the "Rebuild Cache for specific devices/browsers" yet it does not build cache for my phone. Any idea why it's not caching for my phone?

Also, when I put that first line in, the rebuild cache is SO SLOW, but is fairly fast with just these two:
Mozilla/5.0 (Linux; Android 7.1.2; SM-G955F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Mobile Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ 98.0.4758.82 Safari/537.36

I need more help with this!

Here is what's in my .htaccess file:
### LITESPEED_CACHE_START - Do not remove this line
<IfModule LiteSpeed>
CacheLookup on crawler
RewriteCond %{HTTP_COOKIE} !logged_in|cust_logged_in|cart|checkout|compare|wishlist [NC]
RewriteCond %{REQUEST_URI} !account|admin|cart|checkout|logout|wishlist [NC]
RewriteCond %{QUERY_STRING} !nocache|account|admin|cart|checkout|logout|wishlist [NC]

## Uncomment the following directives if you has a separate mobile view
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini" [NC]
RewriteRule .* - [E=Cache-Control:vary=isMobile]
RewriteCond %{HTTP_USER_AGENT} Bot
RewriteRule .* - [E=Cache-Control:vary=isMobileBot]

# Uncomment the following directives if you has a separate Safari browser view
RewriteCond %{HTTP_USER_AGENT} Safari
RewriteCond %{HTTP_USER_AGENT} !Chrome
RewriteCond %{HTTP_USER_AGENT} !CriOS
RewriteRule .* - [E=Cache-Control:vary=isSafari]

RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini" [NC]
RewriteCond %{HTTP_USER_AGENT} Safari
RewriteCond %{HTTP_USER_AGENT} !Chrome
RewriteCond %{HTTP_USER_AGENT} !CriOS
RewriteRule .* - [E=Cache-Control:vary=isMobileSafari]
</IfModule>
### LITESPEED_CACHE_END
 
Last edited:

serpent_driver

Well-Known Member
#13
@Lee

Whatever you try to solve, you won't solve it, if there is no basic conditions. This MASTER condition is, that if your theme has a device detection this dection must be synchronized with cache rules in .htaccess. If there is any difference you will always fail, so the big question is if you have a device detection in your theme or in OpenCart?
 

AndreyPopov

Well-Known Member
#14
for understanding:

- if you not use webp images on your site then you not need to use "Separate view for Safari" and RewriteRule
(Safari not support webp images)

- after RewriteCond always must be RewriteRule
your lines
Code:
RewriteCond %{HTTP_COOKIE} !logged_in|cust_logged_in|cart|checkout|compare|wishlist [NC]
RewriteCond %{REQUEST_URI} !account|admin|cart|checkout|logout|wishlist [NC]
RewriteCond %{QUERY_STRING} !nocache|account|admin|cart|checkout|logout|wishlist [NC]
are wrong


Also, when I put that first line in, the rebuild cache is SO SLOW, but is fairly fast with just these two:
if lscache already exist (for UA/device) then recache runs fast. it's only check "x-litespeed-cache: hit" and go next.
if "x-litespeed-cache: miss" then cache begin generate.


Question: Can you use wildcards to match any version of chrome or safari?

Example:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/*
any sense in wildcards. like wrote serpent_driver - Safari/604.1 and Safari/537.5 are same for cache in most cases.
most detection algorithms use iPhone, Windows NT and Android strings, and also Mobile string for detect device mobile or not
 
Last edited:

Lee

Well-Known Member
#15
- I do use webp images, so you are telling me it will never cache Safari because of this?

- after RewriteCond always must be RewriteRule - Right or wrong it works as intended, this stops my cart from being cached!!! using Journal.

if lscache exist... - I'm aware of how this works, my issue is this: normally it will recache about 3 seconds per line, when I add that user agent it now takes 30-40 seconds per line and constantly stalls out and fails.

I'm just going to back to what works, I have to use my phone with every menu item to cache them, otherwise I'm not able to scroll.

This is a really buggy software and I cannot wait until it matures and works better!
 

serpent_driver

Well-Known Member
#16
This is a really buggy software and I cannot wait until it matures and works better!
You are the one who is buggy. You want a faster Shop? Okay, a fast shop is not for free and forces to learn the basics about what cache is and how a cache works. Otherwise it makes no sense to teach and to help you.

I am out of here!
 

Lee

Well-Known Member
#17
You are the one who is buggy. You want a faster Shop? Okay, a fast shop is not for free and forces to learn the basics about what cache is and how a cache works. Otherwise it makes no sense to teach and to help you.

I am out of here!
Thank you. Always a pleasure... And yes, Journal has a device detection.
Oh, I forgot to add - I AM trying to learn, but keyboard warriors make it tough.
 

AndreyPopov

Well-Known Member
#18
This is a really buggy software and I cannot wait until it matures and works better!
NO!!!

and before ask question you MUST describe your configuration!!!!!!!!!!

as I previously write:

Code:
what Opencart version?
LSWS(LiteSpeed Web Server) or OLS (OpenLiteSpeed)?
PHP version? LSCache plugin version?
native Opencart or modified Opencart build like ocStore?
is third Opencart theme installed?
are different desktop and mobile views?
are in .htaccess present rewrite rules with L flag?
you NOT describe ANY of above!!!!!!!

you NOT understanding how lscache work!!


if lscache exist... - I'm aware of how this works, my issue is this: normally it will recache about 3 seconds per line, when I add that user agent it now takes 30-40 seconds per line and constantly stalls out and fails.
repeat again: without UA you generate cache for unknown user without UA and without cookies!!!
you can not use this cache in real work :(

- after RewriteCond always must be RewriteRule - Right or wrong it works as intended, this stops my cart from being cached!!! using Journal.
by default cache for admin(backend) and all account and cart link DISABLED!
and that-s why your RewriteCond not need anyway!


P.S. OpenLitespeed 1.7.6 (hosting) php 7.3.33 Opencart 3.0.3.1 Journal 3.1.8 (webp enabled) LSCache plugin latest + advanced crawler mode
https://www.priazha-shop.com/
 
Last edited:

Lee

Well-Known Member
#19
I know very well my limitations and while I understand what cache is and what it's supposed to do, lscache is NOT a "plug and play" software. I should never have to do anything but install and have it work correctly - it does not. If it was, YOU would not have to be writing software to fix it's limitations and problems and you would NOT have to be creating tickets on GitHub! Now it may be other factors that are effecting it's ability to work properly for me and that's why I'm here to get help. I'm not here to be insulted or get brow beat. Some things I've done may not be the correct way of doing things but I'm doing my best to work them out any way I can.

Other peoples word salads with no help is worthless! But you've been great, so thank you.

BTW, I knew enough to help write and update your caching software for you!!! Remember?

Also, the cart IS BEING CACHED as well as the LOGOUT process. Customers adding or updating qty in cart would NOT update and they could NOT logout until I added those three lines of code. I'm sorry, you can tell me all you want that I'm wrong but it's very much true and one of those three lines fixed it!

I've since added this to the .htaccess to satisfy the rules: RewriteRule .* - [E=Cache-Control:max-age=300]

Generic cache or not, it's caching my site in windows and iPhone, plus there are MILLIONS of User Agents, how can you possibly know which ones to add? This is why asked if there was wildcards to cover multiple versions of Safari, Chrome etc.

Screenshot 2022-05-20 140926.jpg

what Opencart version? 3.0.3.7
LSWS(LiteSpeed Web Server) or OLS (OpenLiteSpeed)? LiteSpeed Web Server
PHP version? 7.3.33
LSCache plugin version? 3.0-latest
native Opencart or modified Opencart build like ocStore? Have have dozens of 3rd party extensions
is third Opencart theme installed? Journal
are different desktop and mobile views? Not that I'm aware, but there are many settings in Journal for different screen sizes
are in .htaccess present rewrite rules with L flag? Yes, several like this [L,R=301]

I hope this helps some...
 

AndreyPopov

Well-Known Member
#20
is third Opencart theme installed? Journal
are different desktop and mobile views? Not that I'm aware, but there are many settings in Journal for different screen sizes
are in .htaccess present rewrite rules with L flag? Yes, several like this [L,R=301]
Journal 2 or 3?
by default Journal have different Desktop and Mobile View
all lscache rewrite rules must be placed BEFORE any rewrite rules with L flag


LSWS(LiteSpeed Web Server) or OLS (OpenLiteSpeed)? LiteSpeed Web Server
LSWS can use ESI feature to cache cart and account. if you not want use ESI (to cache) - disable it on corresponding tab in plugin GUI and main settings! but NOT your stupid (sorry) RewriteCond rules :(

Generic cache or not, it's caching my site in windows and iPhone, plus there are MILLIONS of User Agents, how can you possibly know which ones to add?
I answer you previously
Code:
most detection algorithms use iPhone, Windows NT and Android strings, and also Mobile string for detect device mobile or not

P.S. OpenLitespeed 1.7.6 (hosting) php 7.3.33 Opencart 3.0.3.1 Journal 3.1.8 (webp enabled) LSCache plugin latest + advanced crawler mode
https://www.priazha-shop.com/

my .htaccess rules for LSCache
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
## Uncomment the following directives if you has a separate Safari browser view
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]
RewriteRule .* - [E=Cache-Control:vary=isMac]
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPad|Petal" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobileapple]
RewriteCond %{HTTP_USER_AGENT} Android [NC]
RewriteCond %{HTTP_USER_AGENT} "Chrome|Firefox|Opera|OPR" [NC]
RewriteCond %{HTTP_USER_AGENT} !Bot [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
</IfModule>
### LITESPEED_CACHE_END
 
Last edited:
Top