How Multi-Language Magento store work with Varnish. Is there any configuration available in varnish,so we can create cache base on cookies?
相关问题
- Magento 1.7.0.2 Index Management overwriting URL R
- Magento: Best way to avoid extension conflicts
- Magento Fatal error: Maximum execution error solut
- jquery/prototype conflicts in Magento
- 404 error when switching between stores when in a
相关文章
- Magento, translate validation error messages
- Magento API order id vs. increment id
- Unique constraint violation on Magento 1.4.0 to 1.
- Editing Magento sales e-mail payment block
- Adding tags to products in Magento
- Magento Collection GroupBy getSize
- Magento upfront payment
- compare only those product who have same category
Add Following lines in Varnish Config,
If you don't mind the languages being at different urls, Turpentine can handle this for you: https://github.com/nexcess/magento-turpentine/issues/36
If you want them to behave as they do out of the box, lets keep going.
You have to modify how varnish generates the has in your VCL Reference: https://www.varnish-cache.org/trac/wiki/VCLExampleCachingLoggedInUsers
We would modify this to also take into account the store cookie that Magento sets based on the language selector. (Following the behavior here: http://demo.magentocommerce.com) Unfortunately this gets tricky as Varnish tends to either not pass cookies back to the server or not cache things when it sees cookies flying around
This would have Varnish cache based on the value of the cookie as well as the default url and host:
But, with this method you might have to tweak the rest of your VCL to cache the page properly AND send the cookies back to the server
Another option is to use the cookie to vary caching on an arbitrary header, lets call it X-Mage-Lang:
This pattern is also used for device detection with varnish: https://github.com/varnish/varnish-devicedetect/blob/master/INSTALL.rst
Then, you would have to extend Mage_Core_Model_App to use this header instead of the 'store' cookie. In Magento CE 1.7 its _checkCookieStore :
You would set the current store on $_SERVER['X-Mage-Lang'] instead of the cookie