I'm using Magento in conjunction with Varnish Cache and I'm developing a module.
Here's my plan: detect URL at the controller_action_predispatch
event and if the URL matches what I'm looking for, run a method.
Pretty simple, and this works:
$this->_action = $observer->getEvent()->getControllerAction();
$request = $this->_action->getRequest();
if ($request->getRequestString() == 'my route') {
//Process Action
}
Say for example, I look for /checkout/cart/
as an example, then this works fine... locally.
On our staging server, we have Varnish Cache running via the Nexcess Turpentine extension. So, /checkout/cart/
looks like this instead:
/turpentine/esi/getBlock/method/esi/access/private/ttl/86400/hmac/7b123a94c32437dbc3e871e9a8671e0c25acfd8b0d9aac4ef67e1a1e0ffe75b0/data/FG4tbo.vXe1BP-stDckM6MmxY8YJuimtBsPXs4DN60EvEjeTv6qGAV8dLiEF6AySMcp8zBoGCxrPo-3i6h1IeueERsjAyw8sRQcvh-5nmMr8wqUlNR36YRv6tgHn9tDsRBwjm6AurTfx46dLgi6HFhJcUwpPkl957MQhMBsN5tfwLWnYS7U0SfNxYKvHaXXyHQcvGVNEpfUKUMPsICC7wzJ7iGaahd8akvZ1VpZ.ifLOfWaXDlqdybZaQj2ZPq85DzBrM2-6sVbdv1fL4OOZxC-0A5iizQcwg9leLR1.n67bKCHYpndbfVxUpTN1Dxystq463pzP5tlm-sy6Sg6GH743ZQw6BMG8wlbgnPfWDu5Gf1Ty1K3Ercz54eOB59r7OCIUzEYE9HFQreMzIUaTEMg9GHBakggdyyi4WuHSB6E=/
I've also tried checking the $_SERVER['REQUEST_URI'];
which yields the same result and Mage::helper('core/helper')->getCurrentUrl();
which is the same again.
I need to find out what route the Varnish Output resolves to, otherwise I cannot judge what page the user is currently visiting.