home of ogirginc

Go Back

Fix SSL error using Heroku’s Redis for Flipper


Hello Redis::CannotConnectError 👋, my old friend. I did not miss you at all.

Years later, I once again, got the SSL connection error while I was adding the Flipper gem to our project, which is hosted on Heroku and uses Heroku’s Redis.

For a quick solution, check this:

# frozen_string_literal: true
require 'flipper/adapters/redis'

Flipper.configure do |config|
  config.default do
    redis = Redis.new(
      url: ENV.fetch('REDIS_URL', nil),
      ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
    )

    adapter = Flipper::Adapters::Redis.new(redis)
    Flipper.new(adapter)
  end
end

If you want to dig deep and understand why it is safe to use “verify none”, you can check the How to solve the SSL error for Redis 6 on Heroku? article that I wrote years ago.