Navigation

Edge Side Includes is a language to include fragments of web pages
in other web pages. Think of it as HTML include statement that works
over HTTP.

On most web sites a lot of content is shared between
pages. Regenerating this content for every page view is wasteful and
ESI tries to address that letting you decide the cache policy for
each fragment individually.

In Varnish we've only implemented a small subset of ESI. As of 2.1 we
have three ESI statements:

esi:include

esi:remove

<!--esi ...-->

Content substitution based on variables and cookies is not implemented
but is on the roadmap.

The <esi:remove> and <!--esi ... --> constructs can be used to present
appropriate content whether or not ESI is available, for example you can
include content when ESI is available or link to it when it is not.
ESI processors will remove the start ("<!--esi") and end ("-->") when
the page is processed, while still processing the contents. If the page
is not processed, it will remain, becoming an HTML/XML comment tag.
ESI processors will remove <esi:remove> tags and all content contained
in them, allowing you to only render the content when the page is not
being ESI-processed.
For example: