config/initializers/session_store.rb
に以下のような記述を行う。
development
では非Secure
production
ではSecureとなる。
# Be sure to restart your server when you modify this file.
#Rails.application.config.session_store :cookie_store, key: 'session'
session_key = '_my_application_session'
expires_in = 1.day
redis_server = {
host: 'localhost',
port: 6379,
db: 0,
namespace: 'session'
}
Rails.application.config.session_store(
:redis_store,
key: session_key,
expires_in: expires_in,
servers: redis_server,
secure: Rails.env.production?
)