Magento – Magento2 varnish is running but not caching page

cachefull-page-cachemagento2performancevarnish

I have configured varnish and enabled this in magento configuration to use in full page cache. Also updated vcl file downloaded from magento. But this doesn't work, every time request's response gives MISS and AGE 0 . Currently running magento in developer mode.
enter image description here

Anyone have any clue why this happening and how can i resolve this.

Best Answer

Based on your screenshot, the first thing you should pay attention to is the Set-Cookie.

Every time a page returns it Varnish Cache will not cache the page.

So you need to remove all the cookie manipulation from the pages you want to cache.

One way you could do that is to use a specific page to treat all the cookies and call it as an AJAX in the pages that are cached.

That way, even if the page is cached that piece of dynamic information will be handled by AJAX.

Remember to add this specific page to the cache exceptions so it will not be cached at all.

Related Topic