清漆 + Rails 导致开发中的真实性令牌无效

发布于 2024-09-13 02:37:53 字数 254 浏览 3 评论 0原文

这是我的情况。我正在我的本地机器上测试 Varnish(我正在做一些与页面缓存相关的事情,每次推动到登台都会很痛苦)。一切正常,除了每当我提交表单时,我都会收到 ActionController::InvalidAuthenticityToken 异常。

Varnish 在本地主机的端口 6081 上运行,Thin 在本地主机的端口 80 上运行。当我尝试使用端口 6081 使用该站点时,出现异常。

有什么办法可以解决这个问题吗?

Here is my situation. I am testing out Varnish on my local box (I'm doing some stuff related to page caching that would be a big pain to push to staging every time). Everything works fine, except whenever I submit a form, I get an ActionController::InvalidAuthenticityToken exception.

Varnish is running on localhost at port 6081, and Thin is running on localhost at port 80. I get the exception when I try to use the site using port 6081.

Is there any way I can get around this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嗫嚅 2024-09-20 02:37:53

好吧,失败的原因是我的 VCL 文件清除了每个请求的所有 cookie。显然,这会导致真实性令牌出现一些问题。

对一个愚蠢问题的愚蠢修复:/

Okay, so the reason this was failing was my VCL file was clearing out all cookies on every request. Obviously, this would cause some issues with the authenticity token.

Silly fix for a silly problem :/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文