Rails 3.0.3 和 InvalidAuthenticityToken
我仅从某些用户那里收到 InvalidAuthenticityToken 异常。当我检查错误时,我可以看到请求已将 "\r\n"
添加到authenticity_token 参数中(即:"authenticity_token"=>"YfYr7bzy1MFzNHPvrSOIdrYuuAG3SHZy/OBJyV3yUSg=\r\ n"
)。
我对浏览器一无所知,只知道它是IE7。
我有一种感觉是他们的防火墙对请求做了一些事情。我认为一个聪明的解决方案是创建一个 Rack 中间件来删除换行符(如果存在)。谁能告诉我如何做到这一点? (我没有机架经验)。
问候,
雅各布
I am, from only some users, getting a InvalidAuthenticityToken exception. When I examine the error I can see that the request has "\r\n"
added to the authenticity_token parameter (ie: "authenticity_token"=>"YfYr7bzy1MFzNHPvrSOIdrYuuAG3SHZy/OBJyV3yUSg=\r\n"
).
I don't know anything about the browser other than that it is IE7.
I have a feeling it is their firewall doing something to the request. I think a smart solution would be to create a Rack middleware that removes the line breaks if they exist. Can anyone show me how that would be done? (I have NO Rack experience).
Regards,
Jacob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经调查过,但找不到解决方案。它不是特别的 IE 或 IE7。我最终制作了以下中间件:
这解决了问题。
I have investigated and I can find no solution for this. It is not IE or IE7 in particular. I ended up making the following middleware:
That solved the problem.