Working on Drupal 7.x

  1. Varnish configured on server (3.0.2)
  2. Downloaded and Enabled Varnish module (Version 7.x)
  3. VCL file configured to support anonymous user varnish cache
  4. Downloaded and Enabled ESI module (Version 7.x-alpha)
  5. Downloaded ESI version 6.x, added the supporting esi_block.VCL files
  6. Configured a block on Home page to Enable ESI & ttl of 1 minute
  7. Page Cache configured for 4 minutes
  8. Cleared cache & Restarted Varnish

Visit home page as anonymous user
Refreshing the home page to see if changes in the block showed up before the pagecache was refreshed. But the ESI did not refresh FOR ANONYMOUS USER after 1 minute.

Please suggest if there are any additional configurations.

Attached default.VCL & esi_block.VCL

CommentFileSizeAuthor
esi_blocks.txt2.81 KBkarthik s
default.txt655 byteskarthik s

Comments

mike.roberts’s picture

Status: Postponed (maintainer needs more info) » Active

Did it refresh after 4 minutes? My guess is that your Page Cache for auth users is trumping your block ESI.

Edit: I meant anonymous users, not authenticated. Varnish is caching the entire page html for 4 minutes, and your block probably isn't actually getting cached through ESI at all. Not sure if you can have varnish page cache + ESI through varnish on the same page without some sort of conflict.

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

Per #1.

robit8deb’s picture

Ive tried adding the default vcl code and i can never get it to start. I even tried added the ; as the compiler suggest but that does not work. Varnish starts without issue without the esi code.

Here is the error:

Message from VCC-compiler:
Expected ';' got 'esi'
(program line 174), at
('input' Line 259 Pos 16)
esi;
---------------###-
Running VCC-compiler failed, exit 1
VCL compilation failed

Here this the full section pasted from the text file example

sub vcl_recv {
call esi_block__recv;
}

sub vcl_hash {
call esi_block__hash;
}

sub vcl_fetch {
# don't ESI anything with a 3/4 letter extension
# (e.g. don't try to ESI images, css, etc).
if (! req.url ~ "\..{3,4}$") {
set beresp.do_esi = true
esi; #<----LINE 259
}

call esi_block__fetch;
}

yannisc’s picture

Same problem here. Did you find any solution?

Status: Active » Postponed (maintainer needs more info)
robinmofo’s picture

Issue summary: View changes

In response to #3, the answer was found in the varnish website

Varnish Site

This is for Varnish 3:
set beresp.do_esi = true

This is for Varnish 2:
esi; #<----LINE 259

dstuart’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)