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
4
votes
1 answer

Varnish & ESIs : Fetching in parallel and possible workarounds

I'm investigating using Varnish with ESIs to cache page content for a high traffic forum-like website. Context : I want to cache content for visitors only (connected users will have a really different display and need absolute fresh content). Still,…
Pascal
  • 49
  • 3
3
votes
2 answers

Edge Side Includes in Laravel

I've been looking at the use of ESI tags in Symfony through Varnish and I'm wondering if the same thing can be done in Laravel, and if so, how? A Senior Developer at work wants us to switch from Laravel to Symfony and is currently using ESI tags as…
João Serra
  • 243
  • 4
  • 14
3
votes
0 answers

Symfony 2.7 how to access to _fragment?

After hours of search, i ask this question here because i think that there is no answers was found for this issue. The problem is very simple: Trying to access to _fragment outside twig that works fine whith render_esi function in twig. I disabled…
skonsoft
  • 1,786
  • 5
  • 22
  • 43
3
votes
1 answer

Symfony2 ESI: Responses marked as public, even if sub-requests include private response

I enabled ESI for my symfony project and try to serve my home page marked as public which includes a private fragment. Home page controller: $response = $this->render("myMainBundle:Page:home.html.twig", $data); $response->setSharedMaxAge(60*60);…
Tobias K.
  • 286
  • 1
  • 3
  • 11
3
votes
2 answers

Symfony ESI get POST Parameter for FORM submit or call ESI as POST

I have a cached site which have a form in it which should not be cached. I use ESI for it. When the form is submit I need to get the POST Parameter in my controller. Symfony let me get the Request Parameter 'form' not the real POST Data or is there…
Alexander Schranz
  • 2,154
  • 2
  • 25
  • 42
3
votes
1 answer

Maintain session for ESI-included requests

I'm having trouble setting up Varnish to properly handle session cookie for ESI-included subrequests. Background, SSCCE Three files: index.php, navigation.php and footer.php combined together using ESI, where first two files are stateful, but only…
Crozin
  • 43,890
  • 13
  • 88
  • 135
3
votes
2 answers

Symfony2: Private ESI Fragment

I am wondering if there exists something like a private ESI fragment. In the docs I read : "set the shared max age - which also marks the response as public" "Once you start using ESI, remember to always use the s-maxage directive instead of…
Thomas K
  • 6,076
  • 5
  • 39
  • 56
3
votes
2 answers

With Symfony2 why are ESI tags inside cached responses ignored?

I have an ecommerce application that I'm try to set up for caching - initially via the Symfony2 Reverse Proxy, but then ultimately via Varnish in production. I'm using Symfony 2.1.8 on Apache2. My problem is I cannot get the ESI tags to be…
Barry
  • 746
  • 9
  • 20
2
votes
2 answers

Caching and Page Views with Varnish/ESI and Zend Framework

I have a few scenarios which I will eventually need to consider in a few months time. Just throwing the question out there so that I can mull on the discussion in the mean time. I am using Zend Framework for my application stack. I'm using APC for…
Layke
  • 51,422
  • 11
  • 85
  • 111
2
votes
0 answers

Full page caching (FastCGI) + CSRF token (Server side loading SSI, ESI, Ajax) + Nginx

first: I have been reading a lot of SO posts, and did not find a satisfying answer. I hope I did not miss the answer. Situation: I'm running a Laravel application (PHP 7.3) I implemented a full page cache using FastCGI (php-fpm) and Nginx It…
Mtxz
  • 3,749
  • 15
  • 29
2
votes
0 answers

How to include content from other side with ESI in Varnish

I want to use ESI in Varnish to combine content from different sides. Every side is a small micro service with a small frontend snippet. ESI should construct the page with the different snippets. I'll be using Varnish 4.0.5. As long I'll use it for…
Mal
  • 324
  • 3
  • 7
2
votes
0 answers

Symfony fragments sometime return 403 to Varnish

A Symfony 2.3 app is on a web server with nginx over port 80. Varnish4 is running on a front-end server on port 80 with Nginx on port 443 as an SSL terminator. This is also tested with Varnish3 with the same results. Mostly this works very…
NoChecksum
  • 1,206
  • 1
  • 14
  • 31
2
votes
1 answer

Symfony2: ESI setMaxAge Cache

I have a Controller whose Action is rendered in twig with {{ render_esi(controller('MyWebsiteBundle:Element:header')) }} The Action itself looks like this: /** * @return Response */ public function headerAction() { …
Zwen2012
  • 3,360
  • 9
  • 40
  • 67
2
votes
0 answers

How to get the protocol of request with esi

Title says it all, I'm wondering how you can access the protocol (http vs https) with ESI. Not finding anything in the developer's guide (http://www.akamai.com/dl/technical_publications/akamai_esi_developers_guide.pdf) or on their example pages.…
user2879041
  • 1,077
  • 1
  • 12
  • 25
2
votes
1 answer

How to handle and debug cache variants in symfony2 / twig

I'd like to know how to handle and check cache variants I'm creating. Let's say I have a project and add ... Logout {{ app.user }} ... to the head of every page. In this case app.user it is a part of fos_user_bundle. For every user…