From e713463a6fcf528ee635ed7e6795615f2752a349 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Sat, 30 Mar 2013 09:50:33 -0500 Subject: [PATCH] [#1134] bootstrap ClassMapGenerator --- cookbook/class_loader/class_map_generator.rst | 38 +++++++++++++++++++ cookbook/class_loader/index.rst | 7 ++++ 2 files changed, 45 insertions(+) create mode 100644 cookbook/class_loader/class_map_generator.rst create mode 100644 cookbook/class_loader/index.rst diff --git a/cookbook/class_loader/class_map_generator.rst b/cookbook/class_loader/class_map_generator.rst new file mode 100644 index 00000000000..24886ec9324 --- /dev/null +++ b/cookbook/class_loader/class_map_generator.rst @@ -0,0 +1,38 @@ +.. index:: + single: ClassLoader; ClassMapGenerator + +ClassMapGenerator Why? +====================== + +Because Symfony2's cache uses the standard HTTP cache headers, the +:ref:`symfony-gateway-cache` can easily be replaced with any other reverse +proxy. Varnish is a powerful, open-source, HTTP accelerator capable of serving +cached content quickly and including support for :ref:`Edge Side +Includes`. + +.. note:: + + Varnish only supports the ``src`` attribute for ESI tags (``onerror`` and + ``alt`` attributes are ignored). + +First, configure Varnish so that it advertises its ESI support by adding a +``Surrogate-Capability`` header to requests forwarded to the backend +application: + +.. code-block:: text + + sub vcl_recv { + set req.http.Surrogate-Capability = "abc=ESI/1.0"; + } + +Then, optimize Varnish so that it only parses the Response contents when there +is at least one ESI tag by checking the ``Surrogate-Control`` header that +Symfony2 adds automatically: + +.. caution:: + + You must protect the ``PURGE`` HTTP method somehow to avoid random people + purging your cached data. + +.. _`Edge Architecture`: http://www.w3.org/TR/edge-arch +.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html \ No newline at end of file diff --git a/cookbook/class_loader/index.rst b/cookbook/class_loader/index.rst new file mode 100644 index 00000000000..7fc347f9edc --- /dev/null +++ b/cookbook/class_loader/index.rst @@ -0,0 +1,7 @@ +ClassLoader +=========== + +.. toctree:: + :maxdepth: 2 + + class_map_generator