I added to varnish config
sub vcl_fetch {
set beresp.do_esi = true;
}
}
In my mvc application I've a childaction
<div>@* this should not be cached, I change the returned value in my DB *@
1 @Html.Action("GetHour", "Index", new { id = 5 })
</div>
<div>
2
<esi:include>@* this should be cached *@
@Html.Action("GetHour", "Index", new { id = 5 })
</esi:include>
</div>
And added a Request header
Request.Headers.Add("X-Esi", "1");
But Varnish keeps caching entire page.
What do I miss?
I've notice in my browser the request header X-Esi doesn't exist.
Also Varnish remove properly the tag <esi:include
The code in action GetHour is pretty simple, just retrieve a decimal from SQL Server.