esi-6.x-2.x comes with a couple of reccomended configuration files; applicable to varnishd (varnish-3.0.2 revision 55e70a4) from Debian "Wheezy" are default_3.0.vcl and esi_blocks_3.0.vcl. However, when I put those snippets into my default.vcl, I'm getting an error like this:

# /etc/init.d/varnish reload
Reloading HTTP accelerator: varnishd
Command failed with error code 106
Message from VCC-compiler:
Expected ';' got 'esi'
(program line 174), at
('input' Line 462 Pos 5)
    esi;
----###-
Running VCC-compiler failed, exit 1
VCL compilation failed
Error: vcl.load … /etc/varnish/default.vcl failed
 failed!

The error references to this section:

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;
  }
  call esi_block__fetch;
}

The VCL compiles only, if I comment out the "if … set beresp … esi;" statement.

The alternative syntax from 'esi' modules' ./docs/default.vcl doesn't work either:

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}$") {
    esi;
  }
  call esi_block__fetch;
}

What am I missin?

Comments

asb’s picture

As suggested in the Varnish docs, I'm using this snippet in sub vcl_fetch {}:

  # How GZIP, and GZIP+ESI works in Varnish
  # https://www.varnish-cache.org/docs/trunk/phk/gzip.html
  if (req.url ~ "html$") {
    set beresp.do_gzip = true;
  }
dstuart’s picture

Status: Active » Closed (outdated)

No longer supported