This is an old revision of the document!


At the bottom of the store, there is a yellow tab to “ To accept cookies from this site, please click the Allow button below.” Each time when customer clicks on “Allow” button, page retrieves from the cache always with yellow bar, but it should be different depend on users.

A site needs to be varying on cookie “user_allowed_save_cookie”. When user click “Allow” cookie, it will insert “user_allowed_save_cookie=%7B%221%22%3A1%7D;” to browser. So, it requires adding a rewrite rule to make the cache varying on that cookie. The cache needs to store two copies: one showing the yellow bar at the bottom while the other one without it.

Add the following rewrite rules to .htaccess

RewriteRule .* - [E=cache-vary:user_allowed_save_cookie]

Alternatively, most people use javascript based plugin and there is no need to set cache vary as above. The better option is to use a different cookie law plugin, then javascript will do the display based on cookie set.

  • Admin
  • Last modified: 2017/05/04 17:06
  • by Jackson Zhang