Questions tagged [esi]

Edge Side Includes or ESI is a small markup language for edge level dynamic web content assembly. The purpose of ESI is to tackle the problem of web infrastructure scaling by inserting ESI include tags directly into cached HTML documents. A ESI processors analyses the document to support different caching mechanisms and times different parts of the document, allowing for increased personalisation of cached pages.

It is fairly common for websites to have generated content. It could be because of changing content like catalogs or forums, or because of personalization. This creates a problem for caching systems. To overcome this problem a group of companies (Akamai, Art Technology Group, BEA Systems, Circadence Corporation, Digital Island, Inc., Interwoven, Inc., Open Market, whose ESI-related technology is now owned by FatWire Software, Oracle Corporation and Vignette Corporation) developed the ESI specification and submitted it to the W3C for approval. The proposal editor was Mark Nottingham.

ESI Language Specification 1.0 was submitted to the World Wide Web Consortium (W3C) for approval in August 2001. The W3C has acknowledged receipt, but has not accepted the proposal.

ESI is implemented by some content delivery networks, such as Akamai, and by some caching proxy servers such as Varnish, Squid and Mongrel ESI, although many do not implement the complete specification. Akamai also adds additional features to the version they support.

How ESI is implemented

ESI element tags are inserted into HTML or other text based content during creation. Instead of being displayed to viewers, these ESI tags are directives that instruct an ESI processor to take some action. The XML based ESI tags indicate to the edge-side processing agent the action that needs to be taken to complete the page's assembly. One simple example of an ESI element is the include tag which is used to include content external to the page. An ESI include tag placed in-line within an HTML document would look like this:

<esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html" onerror="continue"/>

In this case the ESI processor would retrieve the src URL, or failing that the alt URL, or if that failed do nothing. The ESI system is usually a caching proxy server so it may have a local copy of these files which it can insert without going back to the server. Alternatively the whole page with the ESI tags may be cached, and only the ESI requests may be made to the origin server. This allows different caching times for different parts of the page, or different degrees of personalisation.

Features

There are four main features in ESI:

  • inclusion of page fragments, as illustrated above;
  • variables which can be set from cookies or HTTP headers and then used in other ESI statements or written into markup;
  • conditions so that different markup can be used based on variables, for example if a cookie is set or not;
  • error handling, so that a failover can be used if an origin server is unavailable.
112 questions
1
vote
1 answer

How can I include esi tags into main esi tag?

I use esi and Varnish as caching proxy server in my project. The main block has ttl with 1 hour and several blocks into with ttl 10 minutes inside. Is it possible to include esi tags into main esi tag like described below? main.html.twig …
1
vote
1 answer

How to use Varnish ESI with modular PHP templating system

I am looking to implement varnish into a data heavy/user-centric website. How do I setup ESI using a system which uses php to include html templates? I currently use a custom php templating system (similar to an MVC design pattern) which works like…
person
  • 13
  • 4
1
vote
1 answer

Create invalid Json with Newtonsoft - Allow invalid objects?

I'm deliberately trying to create invalid JSON with Newtonsoft Json, in order to place an ESI include tag, which will fetch two more json nodes. This is my JsonConverter's WriteJson method: public override void WriteJson(JsonWriter writer, object…
user3012708
  • 793
  • 1
  • 11
  • 33
1
vote
0 answers

How to configure Varnish to conditionally ignore cookie based on Vary response header?

I'm using Varnish 3 for caching responses from a web application that uses Edge Side Includes (ESI). There are generally two types of responses from ESI endpoints: some are authentication-specific, responses thus use Vary: Cookie,…
MicE
  • 5,038
  • 2
  • 29
  • 26
1
vote
1 answer

ESI tags in Laravel 5.3

For a Laravel 5.3 project I'm currently working on, the breadcrumb should be constructed dynamically based on a certain context. Since we need Varnish on this project I am trying to resort to the use of ESI tags. I've set up a route that renders the…
imot3k
  • 95
  • 1
  • 2
  • 5
1
vote
1 answer

Polyglot frontend in microservices

I'm new to microservices. In my project we're trying to break a monolith application into smaller microservices. It is fairly easy to implement backend systems with polyglot technology. Is the same achievable for frontend? BFF (backend for…
user3886641
  • 31
  • 1
  • 5
1
vote
3 answers

ESI cache on specific route

How could I get varnish to cache a dynamic menu in its different state? My current project (based on Symfony 2.8) uses the KnpMenuBundle and varnish to cache pages. It also make use of ESI in order to disable cache one specific element on some…
thoroc
  • 3,291
  • 2
  • 27
  • 34
1
vote
0 answers

How to use ESI policy to cache logged in user in Magento with Varnish?

I have a Magento site and use Varnish cache to optimize. I installed and configured PageCache module (a FPC extension for Varnish working with Magento), but when a user logged in, the site couldn't be cached. The solution is to implement some ESI…
Linh Văn
  • 121
  • 1
  • 1
  • 4
1
vote
1 answer

accessing php variable inside ESI tag

currently trying to use the ESI include feature of varnish caching system with a php project. in my scenario I need to access the php variables inside the esi tag. something like following...

This article was read

jishan
  • 300
  • 1
  • 4
  • 20
1
vote
0 answers

symfony2 does not use http 304 with AppCache and render_esi

we have a symfony 2.3.35 application in which we make use of the setLastModified header to enable client side caching. For performance improvements we enabled AppCache as reverse proxy but also had to make use of render_esi for a client specific…
1
vote
1 answer

Varnish ESI Request -- What Cookie Is Sent?

New to varnish, not new to HTTP. Apologies if this is newbie/obvious territory, but Googling about hasn't revealed the answer. When varnish makes an request to an esi include url What cookie (and other request information) is it sending along by…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
1
vote
0 answers

Symfony ESI fragments are not found on production environnement

I tried to put Varnish with ESI support like Symfony's documentation suggest. So, I set my trusted proxies and the fragment path. Everything works fine in DEV environnement, but in production, I got 404 error Not found for fragments. It's not a…
skonsoft
  • 1,786
  • 5
  • 22
  • 43
1
vote
0 answers

render_esi & controller => Lost Session

I ask you a question because I browsed all the web but I've not found any answer to my bug. When I use the "render_esi" function from twig with "controller" function, the target page (protected by access_control) is showed, but when the cache time…
1
vote
1 answer

How do I cache an ESI fragment and the corresponding output with Varnish 4.x by IP

I am trying to fetch data from my (PHP) backend using ESI in Varnish 4.x. I want to save (cache) the result in my Varnish instance. The result is unique for every IP address (client.ip) so the hash for the cached result has to be built with…
OpenHaus
  • 97
  • 2
  • 9
  • 17
1
vote
0 answers

ESI Cache - Login / Token is cached

I'm using Symfony 2.4 in my application with ESI Cache (validation cache). Now I have strange problem with login. For example when I log in to a user, log out and next try to log in to another account. Application gives me a token from a first…
Michal Olszowski
  • 795
  • 1
  • 8
  • 25