I have a custom controller for infinite scroll and filtered attributes which simply returns a json response. When modifying a category or product these cached responses are not cleared however.

Looking at the varnish headers the below header is missing for my responses:

X-Magento-Tags: store,cms_b,cat_c,cat_c_79,cat_c_109,cat_c_143,cat_c_182,cat_c_702,cat_c_257,cat_c_304,cat_c_342,cat_c_521,cat_c_533,cms_b_print_header,cms_b_usp,cms_b_social_links,cms_b_payment_methods,cat_c_202,cat_c_p_202,cat_p_17803,cat_p,cat_p_10755

I believe these are how Magento knows to purge from Varnish cache when modifications are made to any of above however am not sure how to make sure these are set within my controller?

There seems to be 2 files I can currently identify that seem to modify this header:


The layoutplugin class seems to just be related to blocks currently on page to add tags however neither seems to be present in response.

I can set the tags like below:

$result->setHeader('X-Magento-Tags', implode(',', $tags));

However need to know an easy way of getting the appropriate tags if possible for that category and products present on that page or how to just get the default method of setting these to kick into action here.

Your Answer

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

Browse other questions tagged or ask your own question.