how to: multiple vary cache by cookie

mkaaaay

Well-Known Member
#1
So I'm having trouble getting this to work: where we need two different cache sets, based on two different cookie values.

What am I doing wrong please?


RewriteCond %{HTTP_COOKIE} _ls_cache_vary_mywebsite_com [NC]
RewriteRule .* - [E=Cache-Control:vary=test_value1]
RewriteRule .* - [E=Cache-Control:vary=test_value2]

I'm expecting one set of cache files with those that have the _ls_cache_vary_mywebsite_com with value of test_value1 and another set for those that have _ls_cache_vary_mywebsite_com cookie with value=test_value2
 

serpent_driver

Well-Known Member
#2
RewriteCond %{HTTP_COOKIE} _ls_cache_vary_mywebsite_com=value_1 [NC]
RewriteRule .* - [E=Cache-Control:vary=test_value1]

RewriteCond %{HTTP_COOKIE} _ls_cache_vary_mywebsite_com=value_2 [NC]
RewriteRule .* - [E=Cache-Control:vary=test_value2]
 

serpent_driver

Well-Known Member
#6
Why? There is nothing wrong, because rewrite rules for cache varies follow Apache directive for rewrite rules. You have 2 different conditions and each condition needs its own rule. Otherwise it's not logical.
 
Top