<div class="gmail_quote"><div>Hi All,</div><div><br></div><div>I am having problem using ESI with Varnish 3.0 successfully. I have an ESI fragment that displays a notice for logged in users, included via an ESI tag. However, varnish caches the included ESI fragment, so changes made to the fragment, either manually, or as a result of a session does not reflect in the including (and cached) web page. </div>

<div><br></div><div>ESI tag as used:</div><div><br></div><div><esi:inlcude src="path/to/fragment.esi"></div><div><br></div><div>VCL configuration:</div><div><br></div><div>sub vcl_recv {</div><div>  if (req.url ~ "[A-Za-z0-9_-]*.esi$") {</div>

<div>    return (pass);  </div><div>  }</div><div><br></div><div>  if (req.http.cookie) {</div><div>    set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");  <span style="white-space:pre-wrap"> </span></div>

<div>     if (req.http.cookie ~ "^ *$") {</div><div>       <span style="white-space:pre-wrap">      </span>  remove req.http.cookie;</div><div>     }</div><div>  }</div><div>  </div><div>  remove req.http.cookie;</div>

<div>  remove req.http.etag;  </div><div>}</div><div><br></div><div>sub vcl_fetch {</div><div> <span style="white-space:pre-wrap">  </span>remove beresp.http.Set-Cookie;</div><div>   <span style="white-space:pre-wrap">        </span>remove beresp.http.ETag;</div>

<div><span style="white-space:pre-wrap">  </span></div><div><span style="white-space:pre-wrap"> </span>#do esi processing</div><div><span style="white-space:pre-wrap">       </span>set beresp.do_esi = true;</div>
<div><span style="white-space:pre-wrap">  </span>if (bereq.url ~ "[A-Za-z0-9_-]*.esi$") {</div><div><span style="white-space:pre-wrap">       </span>   set beresp.ttl = 0s;</div><div>
<span style="white-space:pre-wrap">     </span>} else {</div><div><span style="white-space:pre-wrap"> </span>   set beresp.ttl = 24h;</div><div><span style="white-space:pre-wrap"> </span>} <span style="white-space:pre-wrap">      </span></div>

<div>}</div><div><br></div><div>My assumptions are: </div><div><br></div><div>1) Varnish will make requests to "path/to/fragment.esi" and the re-assemble cache web page every time it fetches from its cache store, especially since beresp.ttl is set to 0s for every .esi fragments</div>

<div>2) Varnish does not store the ESI fragments together with a web page in its cache store</div><div><br></div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse;color:rgb(51, 51, 51)"><div>

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<div><div style="color:rgb(93, 135, 161);font-family:Verdana;font-size:11px"><font color="#000000" face="Helvetica"><span style="font-size:medium"><font color="#5D87A1" face="Verdana" size="3"><span style="font-size:11px"><div style="color:rgb(80, 0, 80)">

<div><font color="#000000" face="Helvetica"><span style="font-size:medium"><font color="#87888A" face="Verdana" size="1"><span style="font-size:9px"><span style="color:rgb(93, 135, 161);font-size:11px"><div><font size="1"><span style="font-size:9px"><font color="#87888A"><div>

<font color="#87888a"><font size="1"><span style="font-size:9px"><br></span></font></font></div></font></span></font></div></span></span></font></span></font></div></div></span></font></span></font></div></div></div></span></div>

</span></div></span></div></span></div></span></div></span></span></div></span><br>
</div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse;color:rgb(51, 51, 51)"><div><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">
<div><div style="color:rgb(93, 135, 161);font-family:Verdana;font-size:11px"><font color="#000000" face="Helvetica"><span style="font-size:medium"><font color="#5D87A1" face="Verdana" size="3"><span style="font-size:11px"><div>
<font color="#535456"><font size="1"><span style="font-size:9px"><font color="#87888A"><div style="color:rgb(93, 135, 161);font-family:Verdana;font-size:11px"><font color="#87888A" size="1"><span style="font-size:9px"><span style="color:rgb(93, 135, 161);font-size:11px"><div>
<span style="color:rgb(135, 136, 138);font-size:9px">////////////////////////////////////////////////////////////////////</span></div></span></span></font></div></font></span></font></font></div><div><font size="1"><span style="font-size:9px"><font color="#87888A"><br>
</font></span></font><b><font size="1"><span style="font-size:9px"><font color="#87888A">Damilare Onajole</font></span></font></b></div><div><div><font size="1"><span style="font-size:9px"><font color="#87888A">Python Developer</font></span></font></div>
<div style="color:rgb(80, 0, 80)"><div><font size="1"><span style="font-size:9px"><font color="#87888A"><br></font></span></font></div><div><b><font size="1"><span style="font-size:9px"><font color="#87888A">Large Blue</font></span></font></b></div>
<div><font size="1"><span style="font-size:9px"><font color="#87888A">120 Long Acre, Covent Garden, London. WC2E 9PA.</font></span></font></div><font size="1"><span style="font-size:9px"><font color="#87888A"><br><a href="http://www.largeblue.com/" style="color:rgb(17, 85, 204)" target="_blank">www.largeblue.com</a><br>
<br></font></span></font></div></div><div style="color:rgb(80, 0, 80)"><div><font size="1"><span style="font-size:9px"><font color="#87888A">+44 (0)20 7240 0330</font></span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:medium"><font color="#87888A" face="Verdana" size="1"><span style="font-size:9px"><br>
</span></font></span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:medium"><font color="#87888A" face="Verdana" size="1"><span style="font-size:9px"><span style="color:rgb(93, 135, 161);font-size:11px"><div>
<font size="1"><span style="font-size:9px"><font color="#87888A">////////////////////////////////////////////////////////////////////</font></span></font></div><div><font size="1"><span style="font-size:9px"><font color="#87888A"><br>
</font></span></font></div><div><font size="1"><span style="font-size:9px"><font color="#87888A"><div style="color:rgb(93, 135, 161);font-family:Verdana;font-size:11px"><font color="#87888a"><font size="1"><span style="font-size:9px">Large Blue is a committed Carbon Neutral company. </span></font></font></div>
<div style="color:rgb(93, 135, 161);font-family:Verdana;font-size:11px"><font color="#87888a"><font size="1"><span style="font-size:9px">Please consider the environment before printing this email</span></font></font></div>
<div><font color="#87888a"><font size="1"><span style="font-size:9px"><br></span></font></font></div></font></span></font></div></span></span></font></span></font></div></div></span></font></span></font></div></div></div>
</span></div></span></div></span></div></span></div></span></div></span></span></div></span><br>