使用Varnish时Magento Onepagechekout登录问题 [英] Magento Onepagechekout login issue when using Varnish

查看:73
本文介绍了使用Varnish时Magento Onepagechekout登录问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:

  • Magento v1.7.0.2,
  • 清漆缓存v3.0.3和
  • 来自IWD(v2.0.9)的一页检出(OPC)模块

我已将路由"onepagecheckout"和"onestepcheckout"添加到应该从Varnish的缓存中排除的路由.

I've added routes "onepagecheckout" and "onestepcheckout" to routes which should be excluded from the cache in Varnish.

我可以看到OPC页面没有从Varnish加载并且可以正常工作,但是,当在OPC页面上使用快速登录表单时,它不能与Varnish一起正常使用. 即使在Magento缓存管理中禁用了所有缓存项(包括Varnish整页缓存).

I can see that OPC page is not loaded from Varnish and works as it should, however, when the quick login form is used on OPC page, it doesn't work properly together with Varnish. Even when all cache items (including Varnish full page cache) have been disabled in Magento Cache Management.

我从/onepagecheckout/index/login/脚本得到以下响应:

What I get is the following response from /onepagecheckout/index/login/ script:

{"success":true,"redirect":"http:\/\/myhost.com\/onepagecheckout\/index\/index\/"}

页面"get"已重定向到购物车,但我仍未登录.

the page get's redirected to the shopping cart but I'm still not logged in.

关闭Varnish时,效果很好.

When switching Varnish off, it works just fine.

有人对此有经验吗?

非常感谢!

推荐答案

最后通过在Varnish的VCL文件中添加以下几行来解决该问题:

Finally solved the issue by adding the following lines to Varnish's VCL file:

if (req.url ~ "^/(index.php/)?(checkout|onepagecheckout)")
{
     return(pipe);
}

尽管,这两个路由已被添加到MADE配置中的从缓存中排除的路由"中(似乎将它们包含在例外列表中)导致在后台出现简单的return(pass).

although, these two routes were already added to "Routes to exclude from cache" in MADE configuration (seems that having them in the exception list) leads to simple return(pass) in the background.

使用return(pipe);代替return(pass);将所有cookie传递给客户端很重要.

It is important to use return(pipe); instead of return(pass); to pass all the cookies to client.

这篇关于使用Varnish时Magento Onepagechekout登录问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆