combined vay cache (cookie + user agent)

mkaaaay

Well-Known Member
#1
We currently have vary caching working well based on cookies. How ever, we need to split them up between desktop and tablet.

How can we combine this below so that we have a single vary where the cookie exists AND the user is on an ipad?

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

RewriteCond %{HTTP_COOKIE} _ls_cache_vary_cookie=customer_zone1 [NC]
RewriteRule .* - [E=Cache-Control:vary=customer_zone1]

Thank you v much.
 

mkaaaay

Well-Known Member
#3
_lscache_vary_cookie doesn't work. So either the docs are wrong or I've got something else wrong.

I have also tried with lscache_vary_ with the same result.

If i login and create a _lscache_vary_cookie based cookie, the page caches fine. However, other users that DO NOT have that _lscache_vary_cookie cookie also see that logged in cache. It is not a vary at all.
 
Last edited:

mkaaaay

Well-Known Member
#4
.... which brings me to my original question: how to add a second cookie tot he vary so that we can vary on say logged_in AND is_tablet ?
 

Pong

Administrator
Staff member
#5
Just write in sequence.

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

then
Cookie vary:

RewriteRule .* - [E=Cache-Vary:_lscache_vary_cookie]

why on _lscache_vary_cookie? You can set your own cookie name to be varied.

By the way,
"If i login and create a _lscache_vary_cookie based cookie, the page caches fine. However, other users that DO NOT have that _lscache_vary_cookie cookie also see that logged in cache. It is not a vary at all." looks something wrong, you can log a ticket and we can check further.
 
Top