Xenforo Cache

semprot

Well-Known Member
#1
Hello, i want to ask about mobile cache separation.

I use this add on
https://xenforo.com/community/resources/browser-detection-mobile-msie.1098/

And i use template such as this :
PHP:
<xen:if is="!{$visitor.getBrowser.isMobile}">
    i am desktop
<xen:else />
    i am mobile
</xen:if>
I also have checked the mobile option in Litespeed Cache add on.

I also have added these lines in my htaccess :
Code:
# LS Cache
<IfModule LiteSpeed>
  #CacheLookup public on
</IfModule>

RewriteCond %{HTTP_USER_AGENT} NokiaN[^\/]*|\ Mobile(\ Safari)?\/|SymbianOS|Silk-Accelerated|Opera(\ |\/)(Mini|8|9\.[0-7])|IEMobile\/|^BlackBerry [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]

RewriteCond %{HTTP_COOKIE} !xf_session [NC]
RewriteRule (.*)?$ - [E=Cache-Control:no-cache]
But it seems cache of mobile & desktop view are randomly served.
For example mobile user gets cached desktop view, and vice versa.

What setting should i check ?

Thank you
 

NiteWave

Administrator
#2
please refer
https://www.litespeedtech.com/suppo...ed_wiki:cache:common:seperate-mobile-versions
"Your rewrite rules must exactly match your backend's mobile detection. If these do not match, you may run into the issue where your rewrite rules think that a device is mobile while the backend does not and visa-versa. This can cause, for example, the desktop version of a page to be cached and flagged as the mobile version which will then be wrongly served to all mobile viewers."
 
Top