I have a content page that uses an esi:include tag to include a module, so let's say
/content.html
contains
<esi:include src="/_esi/module.html">
Both urls send cache-conttrol headers in their response. For /content.html it's
Cache-Control: public, max-age=86400
and for /_esi/module.html it's
Cache-Control:public, max-age=3600
When I load /content.html I can see I am getting a cached response from varnish, and the module.html markup is included appropriately, however, when I change module.html and ban it like: ban req.url == /_esi/module.html
or even if I make that ban broader: ban req.url ~ _esi
the page in my browser still doesn't change.
I can't seem to find much about this in the varnish documentation. Am I able to explicitly invalidate the included content (i.e. the fragment that comes from the ESI url) or do I have to wait for it to expire?
I also tried implementing and using PURGE to achieve this, but I still cannot seem to get fresh content from that include.
Varnish ESI will stitch together the final version of the page on delivery.
If an object is missing, it will send what it has to the client and then wait for a fetch to finish before continuing. If the newly fetched object is also an ESI object and has an include, this leads to another fetch and so on. Includes are handled depth first.
Any object that is ESI-included exists as a regular object in the cache, and can be purged/banned/invalidated like any other object.
As far as what you are seeing, my guess would be that your browser cache is interfering. Try reproducing it on the command line with curl, httpie or lwp-request.