@@ -937,41 +937,33 @@ component cache will only last for 60 seconds.
937
937
938
938
When using a controller reference, the ESI tag should reference the embedded
939
939
action as an accessible URL so the gateway cache can fetch it independently of
940
- the rest of the page. Of course, an action can't be accessed via a URL unless
941
- it has a route that points to it. Symfony2 takes care of this via a generic
942
- route. For the ESI include tag to work properly, you must define the ``_proxy ``
943
- route:
940
+ the rest of the page. Symfony2 takes care of generating a unique URL for any
941
+ controller reference and it is able to route them properly thanks to a
942
+ listener that must be enabled in your configuration:
944
943
945
944
.. configuration-block ::
946
945
947
946
.. code-block :: yaml
948
947
949
- # app/config/routing .yml
950
- _proxy :
951
- resource : " @FrameworkBundle/Resources/config/routing/proxy.xml "
952
- prefix : /proxy
948
+ # app/config/config .yml
949
+ framework :
950
+ # ...
951
+ router_proxy : { path: /_proxy }
953
952
954
953
.. code-block :: xml
955
954
956
- <!-- app/config/routing.xml -->
957
- <?xml version =" 1.0" encoding =" UTF-8" ?>
958
-
959
- <routes xmlns =" http://symfony.com/schema/routing"
960
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
961
- xsi : schemaLocation =" http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd" >
962
-
963
- <import resource =" @FrameworkBundle/Resources/config/routing/proxy.xml" prefix =" /proxy" />
964
- </routes >
955
+ <!-- app/config/config.xml -->
956
+ <framework : config >
957
+ <framework : router-proxy path =" /_proxy" />
958
+ </framework : config >
965
959
966
960
.. code-block :: php
967
961
968
- // app/config/routing.php
969
- use Symfony\Component\Routing\RouteCollection;
970
- use Symfony\Component\Routing\Route;
971
-
972
- $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy'));
973
-
974
- return $collection;
962
+ // app/config/config.php
963
+ $container->loadFromExtension('framework', array(
964
+ // ...
965
+ 'router_proxy' => array('path' => '/_proxy'),
966
+ ));
975
967
976
968
One great advantage of this caching strategy is that you can make your
977
969
application as dynamic as needed and at the same time, hit the application as
0 commit comments