public
Created

Fix for Ruby's inability to properly validate SSL certs on Ubuntu

  • Download Gist
ssl.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.