Turpentine - Varnish Cache

  • Popularity Score 12400 Popularity Score

    Popularity ScoreReferrals to Site/Downloads

    0 0 1+ 1+ 250+ 250+ 1000+ 1000+ 10000+ 10000+

  • Select Technology Partner
Simplify Varnish management and deployment with Magento.
Compatible with:
This extension is currently unavailable on Magento Connect. Please contact the developer.

You will be re-directed to the developer's website to complete your purchase.

You must be registered and logged in to get extension key.
In order to get this extension, you must be logged in to the Magento Community. Click here to login or register.

Magento Connect 2.0

Magento Connect 2.0

Previous Next

Turpentine - Varnish Cache Turpentine Extension for Magento

Turpentine is a full page cache extension for Magento that works with Varnish, a very fast caching reverse-proxy. By default, Varnish doesn't cache requests with cookies and Magento sends the frontend cookie with every request causing a (near) zero hit-rate for Varnish's cache. Turpentine configures Varnish to work with Magento and modifies Magento's behaviour to significantly improve the cache hit rate.

Note that while this extension is now considered stable, it is strongly recommended that it be tested on a development/staging site before deploying on a production site due to the potential need to add custom ESI policies for blocks added by other extensions.


  • Full Page Caching, with hole-punching via Varnish ESI and/or AJAX, even for logged in visitors
  • Configurable via standard Magento methods (Admin system configuration and layout XML), no manual editing of Varnish config required for most cases
  • Able to generate and apply new Varnish VCLs (configurations) on the fly, without restarting/changing Varnish's config files or flushing the cache
  • Blacklist requests from caching by URL or parameters (SID, store, etc)
  • Configure cache TTL by URL and individual block's TTL
  • Supports multiple Varnish instances for clustered usage
  • Automatic cache clearing on actions (clearing product/catalog/cms page after saving)
  • Supports non-root Magento installs (i.e. putting Magento in /store/ instead of /) and multi-store/multi-site setups
  • Support for site-crawlers for cache warming, and includes a (basic) built-in site-crawler
  • SSL support through Pound or Nginx


  • Magento Community Edition 1.6+ or Magento Enterprise Edition 1.11+
  • Varnish 2.1+ (including 4.0)

Installation & Usage

See the Installation and Usage pages.


If you have an issue, please read the FAQ then if you still need help, open a bug report in GitHub's issue tracker.

Please do not use Magento Connect's Reviews or (especially) the Q&A for support, as it is not monitored as closely as github.


If you have a fix or feature for Turpentine, submit a pull request through GitHub to the devel branch. The master branch is only for stable releases. Please make sure the new code follows the same style and conventions as already written code.

How it works

The extension works in two parts, page caching and block (ESI/AJAX) caching. A simplified look at how they work:

For pages, Varnish first checks whether the visitor sent a frontend cookie. If they didn't, then the request will be passed through to Magento in order generate a valid session. Note that the cookie checking is bypassed for clients identified as crawlers (see the Crawler IP Addresses and Crawler User Agents settings).

For blocks, the extension listens for the core_block_abstract_to_html_before event in Magento. When this event is triggered, the extension looks at the block attached to it and if an ESI policy has been defined for the block then the block's template is replaced with a simple ESI (or AJAX) template that tells Varnish to pull the block content from a separate URL. Varnish then does another request to that URL to get the content for that block, which can be cached separately from the page and may differ between different visitors/clients.

Notes and Caveats

  • Turpentine will not help (directly) with the speed of "actions" like adding things to the cart or checking out. It only caches, so it can only speed up page load speed for site browsing. It will remove a lot of load on the backend though so for heavily loaded sites it can free up enough backend resources to have a noticeable effect on "actions".
  • There are some technical limitations when using Varnish 2.1.x: External ESI requests are not blocked, and per-block TTLs in ESI policies are not honored (all blocks use the default TTL)
  • The core parts of Turpentine (caching and ESI/AJAX injection) work under Magento CE 1.5, but a significant portion of the auxillary functionality doesn't work due to changes to event names. That said, it would be possible to use Turpentine with Magento CE 1.5 with an understanding that it is not supported and what actions need to be taken manually. Both cache flushing (both automatic an manual) and cache warming (due to missing events that trigger the cache flushing) do not work.
  • Anonymous blocks are not able to be hole-punched. For CMS pages, it is recommended that you include the block in the page's layout updates XML and give it a name, then it can have an ESI policy like normal

Known Issues

  • Logging and statistics will show all requests as coming from the same IP address (usually localhost/ It should be possible to work around this using Apache's mod_remoteip or mod_rpaf.


See the Demo Sites wiki page.

If you use Turpentine (on a production site), feel free to add your site to the list!


The code is licensed under GPLv2+, much of the ESI-specific code is taken from Hugues Alary's Magento-Varnish extension, which is licensed as GPLv3.

M1 Extension Versions


2013-04-03 21:59:47
  • Version number: 0.5.3
  • Stability: Stable
  • Compatibility: 1.6, 1.6.1,, 1.7, 1.11, 1.11.1, 1.12
You must be registered and logged in to get extension key.

Magento Connect 2.0

Magento Connect 2.0


  • Added runtime model/helper/block rewriting. This negates the need to comment
    out the core/messages block rewrite to really disable the flash messages
    fix when using Turpentine in combination with certain other extensions
  • Add run-time detection of Varnish cli_buffer param to allow for longer VCLs
    after increasing the limit at Varnish start up
  • Added the new Fix Product List Toolbar option (under Varnish Options >
    General) to prevent caching of the products-per-page and product sorting options
    in the product list toolbar. Note that this option defaults to Disabled
  • Added the store and currency cookies to the request hash. This allows
    Varnish to differentiate between multiple stores with the same base URL and
    fixes currency handling.
  • Added a new option to disable the automatic application of the new VCL when
    making changes to the Varnish Options or Caching Options config sections
  • The Flush Catalog Images Cache and Flush JavaScript/CSS Cache no longer
    also flush the corresponding URLs in Varnish. This helps prevent broken images
    and script links after using those buttons.
  • Fixed Varnish ESI parsing failures that some users were experienced. This
    should prevent the "ESI processing not enabled" seen on some blocks
  • Removed the default ESI policy on the checkout.cart block as it was
    causing the shipping and tax quoting to not update correctly. It will be
    re-added in a future release once the quote issue is resolved
  • Added a X-Turpentine-Block header to ESI/AJAX responses containing the
    name of the block rendered
  • Disabled caching of the product comparison popup in the default ESI policy.
    This does not affect the product comparison block, only the popup window
    showing the actual comparison


2013-03-21 22:15:14
  • Version number: 0.5.2
  • Stability: Stable
  • Compatibility: 1.6, 1.6.1,, 1.7, 1.11, 1.11.1, 1.12
You must be registered and logged in to get extension key.

Magento Connect 2.0

Magento Connect 2.0


  • Added profiling calls for more debugging and performance-profiling options
  • Fixed layout XML caching logic to prevent writing to the cache on every
    page load, this should result in a small performance improvement on
    Varnish cache misses
  • Fixed multiple frontend cookies being generated when Magento was installed
    in the root of a domain (/)
  • Added support for translating the SID URL param into the frontend cookie
    for sharing sessions across different domains
  • Added utility script to dump Varnish's active VCL (util/
    for debugging
  • Improve ESI URL redirect interception, Turpentine should now prefer to
    redirect to the referring URL instead of defaulting to /checkout/cart/ all
    the time
  • Re-enabled visitor logging for ESI/AJAX requests, this fixes product
    comparison for non-logged-in visitors


2013-03-06 19:21:54
  • Version number: 0.5.1
  • Stability: Stable
  • Compatibility: 1.6, 1.6.1,, 1.7, 1.11, 1.11.1, 1.12
You must be registered and logged in to get extension key.

Magento Connect 2.0

Magento Connect 2.0


This is the first release of Turpentine marked "stable" in Magento Connect

  • Fix PHP error when Block Logging is turned on
  • Saving a child product of a configurable or grouped product will now also
    cause the parent product(s) to be flushed. This makes saving consistent with
    the out-of-stock flushing behaviour
  • Varnish will now properly distinguish between HTTP and HTTPS responses. This
    should fix warnings in some browsers about mixing secure and insecure content
    when using Varnish+Turpentine behind an SSL proxy


2013-03-01 20:13:05
  • Version number: 0.5.0
  • Stability: Beta
  • Compatibility: 1.6, 1.6.1,, 1.7, 1.11, 1.11.1, 1.12
You must be registered and logged in to get extension key.

Magento Connect 2.0

Magento Connect 2.0


There are changes to the ESI layout syntax (again) in this release, any
customizations that have been done to the ESI layout or added for custom blocks
will need to be updated and moved to the layout.xml file. Additionally, the
Varnish cache will need to be fully flushed or cached pages that reference
previously cached ESI blocks will not load those blocks

  • Added support for event-based partial ESI cache flushing. ESI blocks will
    now only be flushed on the events specified for them in the layout rather than
    all of a client's ESI blocks being flushed on any event that triggered a flush
  • Removed the purge_events option as it was no longer needed with the new
    partial ESI flushing support
  • Removed the need for initial request pass through, Varnish will now generate
    a session token for new visitors and serve them pages from the cache on their
    first visit
  • Fixed CMS pages not being automatically flushed on update
  • Fixed piped requests in Varnish not having headers handled appropriately
  • Added ability to whitelist IP addresses for debug info from Varnish, even
    if Varnish debugging is disabled via Magento's developer IP setting
  • Added flushing on a product page, product review list, and individual review
    view on review saving (such as changing from 'Pending' to 'Approved')
  • Combined the Varnish and ESI debug options
  • Made the logging done by the extension consistent, all messages logged by
    Turpentine will be prefixed with TURPENTINE:
  • Added HMAC signing to the encrypted ESI data to prevent possible
    tampering with the ESI data in the request
  • The turpentine_esi_custom.xml file that was previously suggested to be
    used for custom ESI policies has been removed in favor of Magento's built-in
    facility for this (local.xml). Any ESI policies defined in turpentine_esi_custom.xml
    should be moved the local.xml file in the theme's layout directory to
    prevent issues with the order of defining blocks and setting ESI policies on


2013-02-13 18:58:53
  • Version number: 0.4.0
  • Stability: Beta
  • Compatibility: 1.6, 1.6.1,, 1.7, 1.11, 1.11.1, 1.12
You must be registered and logged in to get extension key.

Magento Connect 2.0

Magento Connect 2.0


There are changes to the ESI layout syntax in this release, any customizations
that have been done to the ESI layout will need to be updated

  • Improved serialization of ESI/AJAX data in URLs. ESI/AJAX URLs should now be
    50-75% as long as they previously were
  • Fixed rare cases of invalid characters in ESI/AJAX URLs, which would cause
    the block to not load or display an error message
  • Unified AJAX and ESI code paths. ESI and AJAX includes no longer use
    duplicated code which will make it easier to add other other inclusion methods
    in the future and reduces the potential for bugs
  • Selecting between AJAX and ESI inclusion is now done with the method
    parameter to setEsiOptions, setAjaxOptions is no longer supported
  • Added ability to cache AJAX requests
  • The old cacheType parameter for setEsiOptions in the layout has been
    split into two new options: scope and access<ul>
  • scope = global: the cached object valid for the entire site
  • scope = page: the cached object is specific to a single page
  • access = public: the cached object is valid for any visitor
  • access = private: the cached object is valid for a single visitor's session
  • ESI block default TTL options have been removed. The new default for public
    ESI blocks is the same as the Varnish page TTL and private blocks use the
    session cookie lifetime as the TTL
  • Turpentine will now detect if there is a difference between how a block
    should be loaded vs how it is requested (ex. manually changing the method
    parameter for a AJAX block to ESI). If ESI debugging is turned off an error
    (403) will be returned
  • Client-side caching will now be used for static assets, in addition to
    Varnish's regular caching (via the Cache-Control header)
  • Improved page rendering performance. Pages that include ESI blocks will now
    render significantly faster (up to 50% in testing), dependant on how many
    ESI block includes were on the page
  • Fixed Turpentine ESI request entries in the Magento visitor log. This should
    result in a small speed-up for AJAX requests particularly as most of the time
    token for the request was spent doing the logging
  • Added custom VCL inclusion. Custom logic can be added to the VCL Turpentine
    generates by putting it in
    app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl. If this
    file is found, Turpentine will automatically include it. Note that it is not
    Varnish version-specific like the other templates, users will need to make sure
    the VCL code used is compatible with the version of Varnish that they use
  • </ul>
    Get Help

    Support for This Extension

    The best place to start if you need help with a specific extension is to contact the developer. All Magento developers have both a contact email and a support email listed.

    Magento Platform Support

    If you need support for a Magento platform, there are different options for support depending on which Magento platform you are using. Below are links for specific platforms.


    About the Developer

    This extension was developed by and is supported by nexcess

    In order to upload extension, you must be logged in to the Magento Community. Click here to login or register.



    * Required Fields

    Close window

    Forgot Your Password?

    Please enter your email below and we'll send you a new password.

    * Required Fields

    Close window


    To upload extension you must be logged in.

    * Required Fields

    Close window

    You are using an outdated browser

    We built Magento Connect using the latest techniques and technologies.
    This makes Magento Connect faster and easier to use.
    Unfortunately, your browser doesn't support those technologies.
    Use the links below to download a new browser or upgrade your existing browser.