Skip to content

Commit 406c6dc

Browse files
committed
MAGETWO-91388: Enable caching of AJAX requests on Varnish/Fastly
1 parent 49bc150 commit 406c6dc

File tree

1 file changed

+3
-2
lines changed
  • app/code/Magento/Swatches/Controller/Ajax

1 file changed

+3
-2
lines changed

app/code/Magento/Swatches/Controller/Ajax/Media.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ public function execute()
6464
$response = $this->getResponse();
6565

6666
if ($productId = (int)$this->getRequest()->getParam('product_id')) {
67+
$product = $this->productModelFactory->create()->load($productId);
6768
$productMedia = $this->swatchHelper->getProductMediaGallery(
68-
$this->productModelFactory->create()->load($productId)
69+
$product
6970
);
70-
$resultJson->setHeader('X-Magento-Tags', 'catalog_product_' . $productId);
71+
$resultJson->setHeader('X-Magento-Tags', implode(',', $product->getIdentities()));
7172

7273
$response->setPublicHeaders($this->config->getTtl());
7374
}

0 commit comments

Comments
 (0)