For some reason I want to disable Full Page Cache for CMS pages including Home Page.
I have created my custom module for this but some reason it is not working.

<?xml version="1.0"?>



class Custom_HeaderFix_Model_Observer {

    public function processPreDispatch(Varien_Event_Observer $observer) {
        $action = $observer->getEvent()->getControllerAction();

        if ($action instanceof Mage_Cms_PageController) {
        $cache = Mage::app()->getCacheInstance();

        // Tell Magento to 'ban' the use of FPC for this request


My code is working on CMS pages but not for home page


If it works for all pages, except the home page, you should replace

if ($action instanceof Mage_Cms_PageController)


if ($action instanceof Mage_Cms_PageController
    || $action instanceof Mage_Cms_IndexController) 
  • Ahh what a poor mistake by me, how can I forget cms page and home page controllers are different. Jul 7 '15 at 11:48
  • How can I remove only the header from FPC Jul 7 '15 at 12:41
  • Holepunching with cache.xml: techytalk.info/… Jul 7 '15 at 12:43

The full page cache uses the event controller_action_predispatch as well and its observer will be executed first because core modules are always loaded before local modules.

I see two possible solutions:

  1. use an event that is triggered before, like controller_front_init_routers - the problem here is that the controller action is not determined yet so you'll have to use the routers' matching methods. This probably makes the page load remarkably slower

  2. Rewrite the full page cache observer pagecache/observer and override processPreDispatch() to check for the controller action before calling the parent method.

  • I will try your code. But my code is working on CMS pages but not for home page. Jul 7 '15 at 11:41

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.