php - Symfony2 ignores routing defaults cache control -


in routing.yml file have following definition according the doc here:

webservice_resources:     path: /webservice/resources     defaults:         _controller: foobarcogsbasebundle:resources:getresourcesbytags         maxage: 3600         sharemaxage: 3600 

but response headers indicate these settings ignored:

cache-control: private 

i expecting see more along lines of this:

cache-control: public,max-age=3600,s-maxage=3600 

why symfony2 ignore cache defaults?

what doing based purely around static templates.

example in symfony2 docs (you not using template, rendering dynamic page appears though):

acme_privacy:     path: /privacy     defaults:         _controller:  frameworkbundle:template:template         template:     'static/privacy.html.twig'         maxage:       86400         sharedage:    86400 

what want (from http://symfony.com/doc/current/book/http_cache.html):

use symfony\component\httpfoundation\response;  $response = new response();  // mark response either public or private $response->setpublic(); $response->setprivate();  // set private or shared max age $response->setmaxage(600); $response->setsharedmaxage(600); 

or per same documentation:

if need set cache headers many different controller actions, might want foshttpcachebundle.

which located @ http://foshttpcachebundle.readthedocs.org/en/latest/


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -