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:
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:
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.