Symfony2 + Varnish-like ESI with Akamai ETS mod_esi Edge Side Include

Akamai provides their own version of an ESI testing server found here:

http://www.akamai.com/html/support/esi.html

Of course it’s not open source, it’s a pre-compiled binary and “Caching of template and fragments is not supported”. Who would shoot themselves in the foot by providing a free version of their commercial offering? Ok yes, Red Hat does but moving on…

I grabbed the FC7 version for CentOS 5.5, extracted, ran the install script with an ETS listening on port 80 and origin host at localhost and port 81. Turn on ESI Debugging too, it’s rather informative being able to view the source with ESI tags and the actions of the server on those tags. To see the debug info view the page source of a request since they’re hidden.

Edit the standard Apache install at /etc/httpd/conf/httpd.conf and change it to listen on port 81.

After setting up Symfony 2′s native ESI handling demo as detailed here:

http://symfony.com/doc/current/book/http_cache.html#edge-side-includes

Akamai’s config will need a couple headers in order for Symfony to respond with ESI tags in the response.

Edit the Akamai config here: /usr/local/ETS/conf/httpd.conf

Edit the VirtualHost directive near the end of the file and add these two directives:

SurrogateHeader Surrogate-Capability ESI/1.0
Accept-Esi 1.0

Now Symfony 2 will see that an ESI Surrogate is making a request and it will respond with the ESI tag instead of filling it in. Develop your app using port 81 and test your ESI through port 80. View the page source to see the debugging info if debugging is enabled.

This guide is similar to the cookbook entry for Varnish which also requires that the surrogate header be set:

http://symfony.com/doc/current/cookbook/cache/varnish.html

This entry was posted in CentOS, Linux, PHP, Server, Symfony2 and tagged , , , , . Bookmark the permalink.

One Response to Symfony2 + Varnish-like ESI with Akamai ETS mod_esi Edge Side Include

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>