Derek Dyer


850 Experience
1 Lesson Completed
1 Question Solved


Posted in Configure Redis Session Store

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

Posted in Configure Redis Session Store

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'

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

© 2024 GoRails, LLC. All rights reserved.