Different Cache for Mobile vs Tablet/Desktop

#1
Greetings.

We have recently made a switch to LiteSpeed + LiteMage to see what it could do for our Magento 2 installation. The installation and general setup of LiteSpeed went well. With just LiteSpeed installed, our pages were served moderately quick and in all aspects it behaved as expected. After installing and configuring LiteMage the site was extremely quick, however we observed that our tablet clients were being served out of the mobile cache.

Is there a setting we can change to serve tablets from the desktop cache?

We tried messing around with the .htaccess settings suggested at: Handling Websites With Separate Mobile Versions but with no luck.

Resolving this one issue would make LiteSpeed the perfect solution for us...

Thanks,

Alex
 

Unique_Eric

Administrator
Staff member
#2
Hi Alex,

Can you try this and also enable debug log on LiteSpeed Web server
Apache config:
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone"
RewriteRule .* - [E=Cache-Control:vary=ismobile]
You may see log, e.g. [CACHE] apply rewrite cache vary value: [ismobile] when mobile user visiting.
 
Last edited by a moderator:
#3
Hi Eric,

Thanks - that was helpful. I've added the following to our .htaccess:

Apache config:
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Android|Opera Mini" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]

RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteRule .* - [E=Cache-Control:vary=tablet]
and I am able to find:

[CACHE] apply rewrite cache vary value: [ismobile]
[CACHE] apply rewrite cache vary value: [tablet]
in the error_log, with the phone vary value being assigned "ismobile" and the tablet vary value assigned "tablet". Unfortunately LS doesn't seem to be honoring the vary values and is still serving them both from the same cache. Is there something else that needs to be set? Anything I should be looking to for clues as to why this is happening?

Best regards,

Alex
 
Last edited by a moderator:

Unique_Eric

Administrator
Staff member
#4
Hi,

Could you try turn on the debug log? Then we can check the header from log together.
You can also submit a ticket with log if you prefer not display it on forum

Best,
Eric
 

Unique_Eric

Administrator
Staff member
#6
Hi,
It's looks fine.

I also did a test, here's my Magento2 with browser tool.

Rules I add
Apache config:
RewriteCond %{HTTP_USER_AGENT} "iPhone" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]

RewriteCond %{HTTP_USER_AGENT} "iPad" [NC]
RewriteRule .* - [E=Cache-Control:vary=tablet]

Step 1, clear cache
Step 2, open browser tool
Step 3 refresh page, you should see a `miss` at first time load

desktop.png

Step 4.
Change to iphone view, and do a refresh, also a `miss`

iphone.png

Step 4.
Change to ipad view, and do a refresh, also a `miss` to me
ipad.png

Can you try my steps? then we can see whats your result.

Best,
Eric
 
Last edited by a moderator:
Top