开发者

Why am I getting ActionController::InvalidAuthenticityToken with every post of my form?

开发者 https://www.devze.com 2023-03-09 13:50 出处:网络
We just rolled out an update to our app which switched to mem_cache_store for sessions.Immediately, all posts to forms threw an ActionController::InvalidAuthenticityToken exception.I understand that t

We just rolled out an update to our app which switched to mem_cache_store for sessions. Immediately, all posts to forms threw an ActionController::InvalidAuthenticityToken exception. I understand that there was a problem with this in 2.3.9, but we're on 2.3.10.

The config change in production.rb is:

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', :name开发者_如何学Pythonspace => '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.

0

精彩评论

暂无评论...
验证码 换一张
取 消