From 552294c729bb8547df980ac2008b984bd6e193ab Mon Sep 17 00:00:00 2001 From: Ho Minh Hiep Date: Thu, 3 Mar 2016 10:21:28 +0700 Subject: [PATCH] Output 'X-Magento-Cache-Debug' header --- .../PageCache/Model/App/FrontController/BuiltinPlugin.php | 5 ++--- .../PageCache/Model/Controller/Result/BuiltinPlugin.php | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php index 7ffbb88ebfd43..a8871f803a1be 100644 --- a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php @@ -91,10 +91,9 @@ protected function addDebugHeaders(ResponseHttp $result) { $cacheControlHeader = $result->getHeader('Cache-Control'); if ($cacheControlHeader instanceof \Zend\Http\Header\HeaderInterface) { - $cacheControl = $cacheControlHeader->getFieldValue(); - $this->addDebugHeader($result, 'X-Magento-Cache-Control', $cacheControl); - $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'MISS', true); + $this->addDebugHeader($result, 'X-Magento-Cache-Control', $cacheControlHeader->getFieldValue()); } + $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'MISS', true); return $result; } diff --git a/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php index 33e5c1000d454..f72a0e3bc46b3 100644 --- a/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php @@ -73,12 +73,11 @@ public function aroundRenderResult( } if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) { - $cacheControlHeader = $result->getHeader('Cache-Control'); + $cacheControlHeader = $response->getHeader('Cache-Control'); if ($cacheControlHeader instanceof \Zend\Http\Header\HeaderInterface) { - $cacheControl = $cacheControlHeader->getFieldValue(); - $response->setHeader('X-Magento-Cache-Control', $cacheControl); - $response->setHeader('X-Magento-Cache-Debug', 'MISS', true); + $response->setHeader('X-Magento-Cache-Control', $cacheControlHeader->getFieldValue()); } + $response->setHeader('X-Magento-Cache-Debug', 'MISS', true); } $tagsHeader = $response->getHeader('X-Magento-Tags');