Ask A Question


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"

gem 'hiredis' # optional

# for sessions
gem 'redis-actionpack'

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

Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.