cancel
Showing results for 
Search instead for 
Did you mean: 

Stop Varnish caching the same site for customers as not-logged-in users

Stop Varnish caching the same site for customers as not-logged-in users

Hi,

 

I'm checking if customers are logged in with "<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>" for the price and the add to cart button in price.phtmllist.phtml and addtocart.phtml

No big deal so far and everything is working as it should be. Non-logged in users don't see prices and the add to cart button, logged in users do.

 

Now I installed Varnish (+Turpentine) and - as expected - it doesn't work anymore because it caches the above mentioned pages without respecting the customer groups "not logged in" and "logged in".

 

Does anybody have an idea how I could make Varnish stop caching the not-logged-in sites if a customer logs in?

 

Thx a lot in advance.

1 REPLY

Re: Stop Varnish caching the same site for customers as not-logged-in users

upgrade turpentine to latest version, and add your code to named block, then use ESI options to refresh this block on page load.

https://github.com/nexcess/magento-turpentine/wiki/ESI_Cache_Policy

------------
MagenX - Magento and Server optimization