diff --git a/book/http_cache.rst b/book/http_cache.rst index db6afebf919..fffc893a7e2 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -937,41 +937,33 @@ component cache will only last for 60 seconds. When using a controller reference, the ESI tag should reference the embedded action as an accessible URL so the gateway cache can fetch it independently of -the rest of the page. Of course, an action can't be accessed via a URL unless -it has a route that points to it. Symfony2 takes care of this via a generic -route. For the ESI include tag to work properly, you must define the ``_proxy`` -route: +the rest of the page. Symfony2 takes care of generating a unique URL for any +controller reference and it is able to route them properly thanks to a +listener that must be enabled in your configuration: .. configuration-block:: .. code-block:: yaml - # app/config/routing.yml - _proxy: - resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" - prefix: /proxy + # app/config/config.yml + framework: + # ... + router_proxy: { path: /_proxy } .. code-block:: xml - - - - - - - + + + + .. code-block:: php - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); - - return $collection; + // app/config/config.php + $container->loadFromExtension('framework', array( + // ... + 'router_proxy' => array('path' => '/_proxy'), + )); One great advantage of this caching strategy is that you can make your application as dynamic as needed and at the same time, hit the application as diff --git a/book/templating.rst b/book/templating.rst index 9c64ed4b1d8..f7f9c6b30b6 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -690,39 +690,32 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: .. note:: - When using a controller instead of an URL, you must enable the Symfony - ``proxy`` routing configuration: + When using a controller instead of a URL, you must enable the Symfony + ``router_proxy`` configuration: .. configuration-block:: .. code-block:: yaml - # app/config/routing.yml - _proxy: - resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" - prefix: /proxy + # app/config/config.yml + framework: + # ... + router_proxy: { path: /_proxy } .. code-block:: xml - - - - - - - + + + + .. code-block:: php - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); - - return $collection; + // app/config/config.php + $container->loadFromExtension('framework', array( + // ... + 'router_proxy' => array('path' => '/_proxy'), + )); Default content (while loading or if javascript is disabled) can be set globally in your application configuration: