How to Solve Sessions Related Issues When Magento-1.x is Running over Ssl and Configured with Varnish-Cache and Turpentine Extension?
To solve sessions related issues for Turpentine when run over ssl, add the following to magento root directory:
mkdir -p /var/www/magento/app/code/community/SupportDesk/CartFormKey/Model mkdir /var/www/magento/app/code/community/SupportDesk/CartFormKey/etc
nano /var/www/magento/app/code/community/SupportDesk/CartFormKey/Model/Observer.php
<?php class SupportDesk_CartFormKey_Model_Observer { function disableCsrf($observer) { $events = array( 'checkout_cart_add', 'checkout_cart_addgroup', 'checkout_cart_updatepost', 'review_product_post', 'sendfriend_product_sendmail', 'wishlist_index_add', 'wishlist_index_update', 'wishlist_index_cart', 'wishlist_index_send', 'catalog_product_compare_add', ); $route = $observer->getEvent()->getControllerAction()->getFullActionName(); if (in_array($route, $events)) { $key = Mage::getSingleton('core/session')->getFormKey(); Mage::app()->getRequest()->setParam('form_key', $key); } } }
nano /var/www/magento/app/code/community/SupportDesk/CartFormKey/etc/config.xml
<?xml version="1.0" ?> <config> <modules> <SupportDesk_CartFormKey> <version>1.0.0</version> </SupportDesk_CartFormKey> </modules> <global> <models> <supportdesk_cartformkey> <class>SupportDesk_CartFormKey_Model</class> </supportdesk_cartformkey> </models> <events> <controller_action_predispatch> <observers> <controller_action_before> <class>supportdesk_cartformkey/observer</class> <method>disableCsrf</method> </controller_action_before> </observers> </controller_action_predispatch> </events> </global> </config>
nano /var/www/magento/app/etc/modules/SupportDesk_CartFormKey.xml
<?xml version="1.0" ?> <config> <modules> <SupportDesk_CartFormKey> <active>true</active> <codePool>community</codePool> </SupportDesk_CartFormKey> </modules> </config> Now clear all cache and sessions.
If result is not found or irrelevant, Please contact us.
Submit your request