Skip to content

Commit 05c9906

Browse files
committed
[HttpKernel] Suppress response content for 304 responses out of the cache
Fixes #1413
1 parent 4824926 commit 05c9906

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class HttpCache implements HttpKernelInterface
5555
*
5656
* * allow_revalidate Specifies whether the client can force a cache revalidate by including
5757
* a Cache-Control "max-age=0" directive in the request. Set it to ``true``
58-
* for compliance with RFC 2616. (default: false)
58+
* for compliance with RFC 2616. (default: false)
5959
*
6060
* * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the
6161
* Response TTL precision is a second) during which the cache can immediately return
@@ -550,7 +550,7 @@ protected function store(Request $request, Response $response)
550550
*/
551551
private function restoreResponseBody(Request $request, Response $response)
552552
{
553-
if ('head' === strtolower($request->getMethod())) {
553+
if ('head' === strtolower($request->getMethod()) || 304 === $response->getStatusCode()) {
554554
$response->setContent('');
555555
$response->headers->remove('X-Body-Eval');
556556
$response->headers->remove('X-Body-File');

0 commit comments

Comments
 (0)