简体   繁体   English

Magento 1.8和Varnish或其他FPC

[英]Magento 1.8 and Varnish or another FPC

As we all really know, there appears a little problem with Magento 1.8.x and Varnish. 众所周知,Magento 1.8.x和Varnish似乎存在一些问题。 Magento team added the support "form_key" for the most the frontend forms and actions. Magento团队增加了对大多数前端表单和操作的支持“ form_key”。 It is really great, everyone should keep safety first. 真的很棒,每个人都应该首先确保安全。 However it causes a problem with FPC systems as Varnish (great article about this is here http://www.supportdesk.nu/blog/110-magento-1-8-form-keys-impact-on-fpc ). 但是,这会导致FPC系统(作为清漆)出现问题(有关此问题的详细文章, 请参见http://www.supportdesk.nu/blog/110-magento-1-8-form-keys-impact-on-fpc )。 Many FPC systems on Magento solves it by putting a placeholder and replace "form_key" during loading a page from cache. Magento上的许多FPC系统通过在缓存中加载页面时放置一个占位符并替换“ form_key”来解决该问题。 It's good for PHP systems that are integrated into Magento , but not for external systems as Varnish. 这对于集成到Magento中的PHP系统是很好的,但是对于Varnish这样的外部系统则不是。 So my question is as follows: 所以我的问题如下:

Is there a good enough solution for using FPC as Varnish and Magento 1.8.x? 是否有足够好的解决方案将FPC用作Varnish和Magento 1.8.x?

I consider follows 我认为如下

1) prevent using of the "form_key" on frontend, there are many way to do this (eg: https://bitbucket.org/supportdesk_nl/turpertine-formkey-workaround/src/574ff1851618dc0e76e4274001fbf3efb89c99f6/app/code/community/SupportDesk/CartFormKey/Model/Observer.php?at=master ). 1)防止在前端使用“ form_key”,有很多方法可以这样做(例如: https ://bitbucket.org/supportdesk_nl/turpertine-formkey-workaround/src/574ff1851618dc0e76e4274001fbf3efb89c99f6/app/code/community/SupportDesk/ CartFormKey / Model / Observer.php?at = master )。 However this is hack and is not good generaly. 但是,这是hack,不是很好。 Moreover could be a security risk? 而且可能会有安全风险吗? What do you mean about this? 你这是什么意思

2) load the "form_key" via AJAX and replace all links and form inputs by JavaScript code. 2)通过AJAX加载“ form_key”,并用JavaScript代码替换所有链接和表单输入。 I'm not sure that it is technicaly realizable (eg: replacing code snippets like onclick="setLocation('....&form_key=XXX');" would be too difficult) and it will causes too many problems and incompatibilities with various extensions. 我不确定它在技术上是否可实现(例如:替换onclick =“ setLocation('....&form_key = XXX');”这样的代码段会太困难),并且会导致太多问题和各种不兼容问题扩展名。

3) do not use Varnish. 3)不要使用清漆。 Yes it would be a solution, but let's avoid them for now, please. 是的,这将是一个解决方案,但请暂时避免使用。

4) Your suggestions ??? 4)您的建议???

Many thanks for your answers. 非常感谢您的回答。

Which FPC are you trying to use anyway? 您到底想使用哪个FPC? We use Lesti FPC (with Redis Cache backends, and session backends) with Varnish and it works fine. 我们将Lesti FPC(带有Redis Cache后端和会话后端)与Varnish一起使用,效果很好。

I don't know if you've properly read one of the links you posted, but Lesti FPC is already patched via this commit, 5 months ago . 我不知道您是否已正确阅读所发布的链接之一,但Lesti FPC已在5个月前通过此提交进行了修补。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM