Drupal blocks as Edge Side Includes

Last week, I wrote about using Varnish with Drupal. One aspect we didn't cover are Varnish'  features for Edge Side Includes.

What are Edge Side Includes?
These are just a way to tell your reverse proxy (Varnish) that some parts of the page should get some special attention. For example a shorter expire time (TTL) or if they should be cached by USER, PAGE or by ROLE. If you know your site well enough, you can provide some caching for authenticated users this way. Especially in combination with the block cache alter module. Beneath is an example how an ESI include could look like for a block in Drupal:

  <esi:include src="/esi/block/garland:col_right_middle:block:0/ZnJvbnQ=/CACHE=USER">

So, there's a module for that?
Yes, there is a ESI module for Drupal. But it is pretty cutting edge, beta, and at time of writing not very up-to-date with the latest VCL syntax for Varnish 2.1. So you should at least apply this patch In my case I also made some paches to make it work with the context module. But my guess is the code will get refactored soon as this is only phase 1.

Update february 2011:

During the DrupalDevDays in Brussels, this presentation on Drupal + Varnish + Esi was shown. Including some explanation about options to clear your cache using purge or expire modules.

Pressflow and Varnish, advanced hosting for Drupal

Read More »


This is the company blog of
Drupal specialist Merge.nl

We are located in Breda (Netherlands) and build websites using Drupal. More about us.

Content on this blog is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.

Creative Commons License

Recent Comments