1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

redis-store(redis-rails) で Redis に SSL 接続する方法

Last updated at Posted at 2018-06-27

redis-railsrediss://hogehoge 形式でSSL接続をしようとすると、SSL であることを無視して、redis://hogehoge で繋ごうとする問題。

実際の問題は redis-rails で使われている redis-store 側にあって、この問題は対応中で近々マージされる様子
Honor rediss:// schemes in URI by fancyremarker · Pull Request #306 · redis-store/redis-store

対処方法

取り急ぎの対処方法として、Hash で接続情報を渡してあげれば OK

Rails.application.config.session_store :redis_store,
  servers: URI.parse(ENV['REDIS_SESSION_STORE']).tap { |uri|
    break {
      host: uri.host,
      port: uri.port,
      password: uri.password ? CGI.unescape(uri.password) : nil,
      db: uri.path.split('/')[1] || 0,
      namespace: uri.path.split('/')[2] || nil,
      scheme: uri.scheme,
    }.compact
  }
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?