Skip to content

Instantly share code, notes, and snippets.

@marcweil
Created October 25, 2011 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcweil/1311255 to your computer and use it in GitHub Desktop.
Save marcweil/1311255 to your computer and use it in GitHub Desktop.
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