1

I have submitted an extension to Magento Marketplace but they reported below error:

Expected HIT on the second page load. Expected HIT on the second page load after product price update.

{"command":"Varnish PageCache Test","output":{"Expected HIT on the second page load.":["http://magento.local/simple-product-1.html page doesn't contain HIT in cache header.","http://magento.local/simple-product-2.html page doesn't contain HIT in cache header.","http://magento.local/simple-product-3.html page doesn't contain HIT in cache header.","http://magento.local/category-1.html page doesn't contain HIT in cache header.","http://magento.local/category-2.html page doesn't contain HIT in cache header.","http://magento.local/ page doesn't contain HIT in cache header."],"Expected HIT on the second page load after product price update.":["http://magento.local/simple-product-1.html page doesn't contain HIT in cache header.","http://magento.local/simple-product-3.html page doesn't contain HIT in cache header."]}

I am not sure what exactly to add to get the package be successfully validated at Magento Marketplace. Please help me if someone have any idea on it.

  • did you get any solution? – Mohit Rane May 22 at 8:24
2

This error means that the extension prevents product and category pages from being cached by Varnish. One possible cause is using cacheable="false" in one or more blocks on product and category pages.

Background

In late 2017 Magento announced that they will require all extensions submitted to the Marketplace to be compatible with full-page cache (Varnish):

Keeping in line with our efforts to improve the quality of all extensions on Marketplace, as of 1/2/18 we will be implementing Varnish cache validation during Technical Review for all M2 submissions.The Varnish test verifies products do not break Varnish caching when in production mode.

Full-page caching in Magento 2

Magento 2 distinguishes two types of cacheable content: public and private - the former being everything that's publicly accessible to anyone (e.g. category listing), the later everything that's specific to a single user (e.g. shopping cart).

The way those two types of content are handled is that a full-page cache (Varnish) caches the whole page with only public content present, and any private content on this page is handled by UI Components in the browser.

Testing an extension with Varnish

To test whether an extension is compatible with Varnish:

  1. Configure the environment to use Varnish as described in Magento dev docs
  2. Test the product page: curl -I http://magento2.local/sample-producth.html. In the response headers there should be X-Magento-Cache-Debug with value MISS. Run the command again - now the header should have value HIT.
  3. Repeat the same test for the category page.

If you don't get a HIT on second and following attempts, make sure that your environment is configured correctly by running the test on a vanilla Magento instance.

If you don't see the X-Magento-Cache-Debug header at all, make sure that Magento is running in developer mode and your request goes through Varnish and not directly to Apache/nginx.

| improve this answer | |
  • @Maniek, I configured the varnish 6 in my local, and when I ran the curl -I <product_url>, I didn't see any values like X-Magento-Cach-Debug in the result, then right now my application in developer mode. – senthil Jan 29 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.