Ask A Question

Notifications

You’re not receiving notifications from this thread.

Configure Redis Session Store

Derek Dyer asked in Rails

Seems pretty straight forward however, I am getting an invalid authenticity token error upon form post with my app.

Here's what I have set in config/environments/development.rb:

  config.session_store :redis_store,
                       servers: ['redis://localhost:6379/session'],
                       expire_after: 90.minutes,
                       key: "_<app_name>_session",
                       threadsafe: false,
                       secure: true

Here's relevant (IMO) gems in my gemfile:

# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"

# https://github.com/redis/hiredis-rb
gem 'hiredis' # optional

# for sessions
gem 'redis-actionpack'
Reply

The issue was that I had secure: true set per the documentation. This enforces ssl/https and I was in a local dev env

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,168+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.