Codeigniter:Paypal IPN和csrf_protection [英] Codeigniter: Paypal IPN and csrf_protection

查看:195
本文介绍了Codeigniter:Paypal IPN和csrf_protection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 codeigniter-paypal-ipn 并启用csrf_protection。
这似乎阻止了从Paypal到我的IPN控制器的访问。如果我禁用csrf_protection它工作正常,启用csrf_protection,paypal IPN服务引发一个500内部服务器错误。



有没有办法解决这个没有禁用csrf_protection?
如果没有,我是否可以只为该控制器禁用csrf_protection?



谢谢。

这里是 codeigniter-paypal-ipn 的创作者。目前我不知道一个方法来获得IPN后使用csrf_protection工作已启用。如果你看看另一种语言/框架是如何做的,例如。 django-paypal IPN - 他们将 CSRF豁免添加到具体的IPN控制器



imm 所述,这种类型的细粒度控制将不会在CodeIgniter中可用,直到版本与此拉请求合并(如果您不能等待,请尝试 case 的方法如下,因为它不涉及黑客CI核心...)



我更新了项目的 README ,以使CSRF情况更清楚。


I'm working with codeigniter-paypal-ipn and have csrf_protection enabled. This seems to block the access from Paypal to my IPN controller. If i disable csrf_protection it works just fine, with csrf_protection enabled, paypal IPN service throws a 500 Internal Server Error.

Is there a way to solve this without disabling the csrf_protection? If not, can i disable the csrf_protection just for that controller?

Thanks.

解决方案

Alex the creator of codeigniter-paypal-ipn here. At the moment I'm not aware of a way to get the IPN post working with csrf_protection enabled. If you look at how another language/framework does it, e.g. django-paypal IPN - they add a CSRF exemption to the specific IPN controller.

As imm says, this type of fine-grained control won't be available in CodeIgniter till a version with this pull request is merged (if you can't wait, try caseyamcl's approach below as it doesn't involve hacking CI core...)

I've updated my project's README to make the CSRF situation clearer.

这篇关于Codeigniter:Paypal IPN和csrf_protection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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