Tag: httpcaching

如果第一个响应与AppCache(Symfony2)是私密的,那么它是否正确?

我试图使用httpcaching。 在我的控制器中,我设置了一个响应,如下所示: $response->setPublic(); $response->setMaxAge(120); $response->setSharedMaxAge(120); $response->setLastModified($lastModifiedAt); 开发模式 在开发环境中,第一个响应是200以下标题: cache-control:max-age=120, public, s-maxage=120 last-modified:Wed, 29 Feb 2012 19:00:00 GMT 接下来的2分钟,每个响应是一个304以下标题: cache-control:max-age=120, public, s-maxage=120 这基本上是我所期望的。 产品模式 在产品模式下,响应标头是不同的。 请注意,在app.php中我将内核包装在AppCache中。 第一个响应是200以下标题: cache-control:must-revalidate, no-cache, private last-modified:Thu, 01 Mar 2012 11:17:35 GMT 所以这是一个私人的无caching响应。 接下来的每一个请求都是我所期望的。 304以下标题: cache-control:max-age=120, public, s-maxage=120 我应该担心吗? 这是一个预期的行为? 如果我把Varnish或Akamai服务器放在它的前面会发生什么? 我做了一些debugging,我发现这个响应是私有的,因为最后修改的头文件。 HttpCache内核使用EsiResponseCacheStrategy来更新caching的响应( HttpCache :: handle()方法)。 if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->esiCacheStrategy->update($response); […]