Based on my previous question, in Enterprise Edition Magento it doesn’t appear to be a good idea to use any of the available controller events if you are planning on having the full page caching enabled. It looks to be you only want to use these events if you are doing something with the actual page.
However, we have built some extensions for Magento that on controller_action_predispatch, we have an observer and from there we grab a parameter in the URL and if it is set correctly we do some additional functionality from there. For example, we have made it so a client can put promo codes in urls for email campaigns and when they click that link it is attached to the customer’s quote. We have to look for the parameter before the page is loaded and do our thing.
But now that there is this full page caching it isn’t working correctly. So is it probably better to not do this with an Observer and just extend the code? Or are there better Observers to do this with. We tried to use HTTP send response before one and got mixed results.
If you want to keep your investment in the
controller_action_predispatchevents and stay in the Magento framework for your code, you could do a couple of things.Add the URL param into the cache key. That way the FPC will serve the different versions of the page that the param can trigger while still giving the benefit of caching. Refer to this blog post for an example of creating your own PageCache container and overriding the cache key.
Exclude those controllers from FPC. Obviously this is only valid if the controllers affected are a subset of the overall site, otherwise you won’t get any caching benefit.
Cheers,
JD