Getting Varnish To Work on Magento

Josh Pennington picture Josh Pennington · Feb 17, 2011 · Viewed 31.2k times · Source

First please forgive me for total lack of understanding of Varnish. This is my first go at doing anything with Varnish.

I am following the example at: http://www.kalenyuk.com.ua/magento-performance-optimization-with-varnish-cache-47.html

However when I install and run this, Varnish does not seem to cache. I do get the X-Varnish header with a single number and a Via header that has a value of 1.1 varnish

I have been told (by my ISP) it is because of the following cookie that Magento sets:

Set-Cookie: frontend=6t2d2q73rv9s1kddu8ehh8hvl6; expires=Thu, 17-Feb-2011 14:29:19 GMT; path=/; domain=XX.X.XX.XX; httponly

They said that I either have to change Magento to handle this or configure Varnish to handle this. Since changing Magento is out of the question, I was wondering if someone can give me a clue as to how I would configure Varnish to handle this cookie?

Answer

Mario picture Mario · May 25, 2011

http://moprea.ro/2011/may/6/magento-performance-optimization-varnish-cache-3/ describes the Magento extension that enables full page cache with varnish. This extension relies on Varnish config published on github.

These are the features already implemented:

  1. Workable varnish config
  2. Enable full page caching using Varnish, a super fast caching HTTP reverse proxy.
  3. Varnish servers are configurable in Admin, under System / Configuration / General - Varnish Options
  4. Automatically clears (only) cached pages when products, categories and CMS pages are saved.
  5. Adds a new cache type in Magento Admin, under System / Cache Management and offers the possibility to deactivate the cache and refresh the cache.
  6. Notifies Admin users when a category navigation is saved and Varnish cache needs to be refreshed so that the menu will be updated for all pages.
  7. Turns off varnish cache automatically for users that have products in the cart or are logged in, etc.)
  8. Default varnish configuration offered so that the module is workable. Screen shots: https://github.com/madalinoprea/magneto-varnish/wiki