[Varnish] #247: Varnish sends 304 header for ESI pages although some of the included objects might have changed

Varnish varnish-bugs at projects.linpro.no
Wed Jun 11 14:46:21 CEST 2008

#247: Varnish sends 304 header for ESI pages although some of the included
objects might have changed
 Reporter:  peter     |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
 I've replicated the ESI example of the Wiki using PHP. My VCL (which is
 based on the example from the man page) looks like follows:
 backend default {
   .host = "dev";
   .port = "http";

 sub vcl_recv {
   set req.http.X-Forwarded-For = client.ip;
   set req.http.Host = "dev";

 sub vcl_pipe {

 sub vcl_pass {

 sub vcl_hash {
   set req.hash += req.url;
   set req.hash += req.http.host;

 sub vcl_hit {

 sub vcl_miss {

 sub vcl_fetch {
   if (!obj.valid) {

   if (req.url == "/test.html") {
       esi;  /* Do ESI processing */
       set obj.ttl = 24 h;
   } elseif (req.url == "/date.php") {
       set obj.ttl = 1m;


 sub vcl_deliver {

 sub vcl_timeout {

 sub vcl_discard {
 The PHP script (date.php) is responsible for printing the current date.

 Everything seems to work fine. The date.php file output is cached for a
 minute and if I keep refreshing my browser I get to see a new version
 after a minute. The ESI include inside the test.html file also seems to
 work fine because the date is displayed inline if I request the test.html

 However, when I keep refreshing the test.html file the browser receives a
 304 Unmodified header and after that doesn't seem to do a new request
 anymore. Even after a minute if I do a simple refresh in the browser I
 still get to see the old date. Only if I force a refresh using SHIFT-
 REFRESH I get to see the new date.

 So although the ESI include works fine, and the inline content is being
 updated, it seems that the headers that get send by Varnish are not
 entirely correct.

 But this might also be my fault in some way?

Ticket URL: <http://varnish.projects.linpro.no/ticket/247>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list