redis-store / redis-actionpack

Redis stores for ActionPack
http://redis-store.org/redis-actionpack
MIT License
76 stars 44 forks source link

Session is not found on the next request when 'signed: true' #33

Closed chumakoff closed 4 years ago

chumakoff commented 4 years ago

I am using this gem to store Rails application session in Redis. Now I am testing it in development mode on localhost:3000

Everything works fine except for the case when I set 'signed' option to true.

In that case when I assign any value in the 'session', I can see in the browser that the corresponding cookie key is created successfully. However, when I try accessing the assigned session value on the next request, it returns nil.

# setting value in session
session[:foo] = "bar"

# on next request
session[:foo] # => nil

Also, when I assign a session value again, the cookie value in the browser changes (gets replaced with a new value). Tested in Chrome and Firefox

Session store configuration:

Rails.application.config.session_store :redis_store, 
    servers: [ENV.fetch("REDIS_URL")],
    key: "_project_name_session",
    expire_after: 90.minutes,
    signed: true

Environment:

Ruby 2.6.6
Rails 5.2.4

# Gems:
redis (4.2.1)
redis-actionpack (5.2.0)
redis-rack (2.1.2)
redis-store (1.9.0)

puma (3.12.6)
rack (2.2.3)
chumakoff commented 4 years ago

Found similar issue here https://github.com/redis-store/redis-actionpack/issues/29

Using this gems versions (as in the above issue) fixed my problem too:

gem 'redis-actionpack', '5.1.0'
gem 'redis-rack', '2.0.6'