Skip to content

Instantly share code, notes, and snippets.

@blefev
Last active June 23, 2022 03:51
Show Gist options
  • Save blefev/181dde11da37495adc1f42392eb4d0b7 to your computer and use it in GitHub Desktop.
Save blefev/181dde11da37495adc1f42392eb4d0b7 to your computer and use it in GitHub Desktop.
Ruby Gems / Bundler Behind SSL Proxy One Liner

Getting this error when doing rails new ... while behind an SSL proxy?

Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see https://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

Add your custom certificate authority in .pem format to Rubygems certs:

cp YOUR_CERT.pem "`gem which rubygems | sed 's/rubygems.rb//'`/rubygems/ssl_certs/rubygems.org/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment