[英]Why am I getting ActionController::InvalidAuthenticityToken with every post of my form?
We just rolled out an update to our app which switched to mem_cache_store for sessions.我们刚刚推出了对我们的应用程序的更新,它切换到 mem_cache_store 进行会话。 Immediately, all posts to forms threw an ActionController::InvalidAuthenticityToken exception.
立即,forms 的所有帖子都引发了 ActionController::InvalidAuthenticityToken 异常。 I understand that there was a problem with this in 2.3.9, but we're on 2.3.10.
我知道 2.3.9 中存在此问题,但我们使用的是 2.3.10。
The config change in production.rb is: production.rb 中的配置更改为:
require_library_or_gem 'memcache'
config.action_controller.session_store = :mem_cache_store
config.action_controller.session = {
:secure => true,
:cache => MemCache.new('our.memcache.host', :namespace => 'rack:session')
}
Am I doing something wrong?难道我做错了什么?
You need to rename the session key whenever you move the session store to prevent ActionController::InvalidAuthenticityToken errors.每次移动 session 存储时,都需要重命名 session 密钥,以防止出现 ActionController::InvalidAuthenticityToken 错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.