rails 4 resets session on every request in production -
i implementing web app using rails 4.2.0 , ruby 2.2.0 , facing problem time request in done new session set. in case cannot save session since it's gone. leads situation authenticity token cannot checked.
for testing purpose forgery protection disabled in applicationcontroller
, that's not reason why session reset.
class applicationcontroller < actioncontroller::base #protect_from_forgery with: :null_session skip_before_action :verify_authenticity_token ` end
i using active record store save session, same happens cookie store:
myapp::application.config.session_store :active_record_store, :key => '_myapp_session', domain: :all, tld_length: 2
every time request done new entry sessions
table inserted new sessions_id
, session cookie in browser points new session.
any ideas reset session?
this happens in production environment. in development fine.
your issue due call skip_before_action :verify_authenticity_token
; if authenticity token not verified, rails reset session. want re-enable protect_from_forgery
.
i've seen ajax requests without authenticity token cause session reset, again more detail here: http://www.kalzumeus.com/2011/11/17/i-saw-an-extremely-subtle-bug-today-and-i-just-have-to-tell-someone/
Comments
Post a Comment