Create a gist now

Instantly share code, notes, and snippets.

Fix for Ruby's inability to properly validate SSL certs on Ubuntu
if Rails.env == 'production' or Rails.env == 'staging'
require 'open-uri'
require 'net/https'
module Net
class HTTP
alias_method :original_use_ssl=, :use_ssl=
def use_ssl=(flag)
self.ca_file = '/etc/ssl/certs/ca-certificates.crt'
self.verify_mode = OpenSSL::SSL::VERIFY_PEER
self.original_use_ssl = flag
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment