app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php
public function checkRedirectUrl($eventObject) {
        $esiHelper = Mage::helper('turpentine/esi');
        $url = $eventObject->getTransport()->getUrl();
        $referer = Mage::helper('core/http')->getHttpReferer();
        $dummyUrl = $esiHelper->getDummyUrl();
        $reqUenc = Mage::helper('core')->urlDecode(
            Mage::app()->getRequest()->getParam('uenc') );

        if ($this->_checkIsEsiUrl($url)) {
            if ($this->_checkIsNotEsiUrl($reqUenc) &&
                    Mage::getBaseUrl() == $url) {
                $newUrl = $this->_fixupUencUrl($reqUenc);
            } elseif ($this->_checkIsNotEsiUrl($referer)) {
                $newUrl = $referer;
            } else {
                $newUrl = $dummyUrl;
            }
            // TODO: make sure this actually looks like a URL
            $eventObject->getTransport()->setUrl($newUrl);
        }

        if ($eventObject->getTransport()->getUrl() != $url) {
            Mage::helper('turpentine/debug')->logDebug(
                'Detected redirect to ESI URL, changing: %s => %s',
                $url, $eventObject->getTransport()->getUrl() );
        }
    }
public function checkRedirectUrl($eventObject) {
        $esiHelper = Mage::helper('turpentine/esi');
        $url = $eventObject->getTransport()->getUrl();
        $referer = Mage::helper('core/http')->getHttpReferer();
        $dummyUrl = $esiHelper->getDummyUrl();
        $reqUenc = Mage::helper('core')->urlDecode(
            Mage::app()->getRequest()->getParam('uenc') );

        if ($this->_checkIsEsiUrl($url)) {
            if ($this->_checkIsNotEsiUrl($reqUenc) &&
                    Mage::getBaseUrl() == $url) {
                $newUrl = $this->_fixupUencUrl($reqUenc);
            } elseif ($this->_checkIsNotEsiUrl($referer)) {
                $newUrl = $referer;
            } else {
                $newUrl = $dummyUrl;
            }
            // TODO: make sure this actually looks like a URL
            $eventObject->getTransport()->setUrl($newUrl);
        }

        if ($eventObject->getTransport()->getUrl() != $url) {
            Mage::helper('turpentine/debug')->logDebug(
                'Detected redirect to ESI URL, changing: %s => %s',
                $url, $eventObject->getTransport()->getUrl() );
        }
    }
public function checkRedirectUrl ( $ eventObject ) { $ esiHelper = Mage :: helper ( 'turpentine/esi' ) ; $ url = $ eventObject -> getTransport ( ) -> getUrl ( ) ; $ referer = Mage :: helper ( 'core/http' ) -> getHttpReferer ( ) ; $ dummyUrl = $ esiHelper -> getDummyUrl ( ) ; $ reqUenc = Mage :: helper ( 'core' ) -> urlDecode ( Mage :: app ( ) -> getRequest ( ) -> getParam ( 'uenc' ) ) ; if ( $ this -> _checkIsEsiUrl ( $ url ) ) { if ( $ this -> _checkIsNotEsiUrl ( $ reqUenc ) && Mage :: getBaseUrl ( ) == $ url ) { $ newUrl = $ this -> _fixupUencUrl ( $ reqUenc ) ; } elseif ( $ this -> _checkIsNotEsiUrl ( $ referer ) ) { $ newUrl = $ referer ; } else { $ newUrl = $ dummyUrl ; } // TODO: make sure this actually looks like a URL $ eventObject -> getTransport ( ) -> setUrl ( $ newUrl ) ; } if ( $ eventObject -> getTransport ( ) -> getUrl ( ) != $ url ) { Mage :: helper ( 'turpentine/debug' ) -> logDebug ( 'Detected redirect to ESI URL, changing: %s => %s' , $ url , $ eventObject -> getTransport ( ) -> getUrl ( ) ) ; } }
On controller redirects, check the target URL and set to home page
if it would otherwise go to a getBlock URL

@param  Varien_Object $eventObject
@return null
On controller redirects check the target URL and set to home page if it would otherwise go to a getBlock URL