rest-client gem doesnt work with Cloudflare SSL certificate

82 views Asked by At

The rest-client gem is not working with Clourflare Shared SSL, I'm getting the following error:

irb(main):001:0> require 'rest-client'
=> true
irb(main):002:0> RestClient.get('https://bkam.com')
RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=error: certificate verify failed:
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:445:in `rescue in transmit'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:350:in `transmit'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient.rb:65:in `get'
    from (irb):3
    from /usr/local/bin/irb:11:in `<main>'

And here is when I try the same URL with cURL:

#curl -I https://bkam.com
HTTP/1.1 301 Moved Permanently
Server: cloudflare-nginx
Date: Sun, 21 Jun 2015 14:37:25 GMT
Content-Type: text/html
Connection: keep-alive
Set-Cookie: __cfduid=d186172655f741ece4bb040858a27a4a51434897445; expires=Mon, 20-Jun-16 14:37:25 GMT; path=/; domain=.bkam.com; HttpOnly
Cf-Railgun: direct (starting new WAN connection)
Location: https://eg.bkam.com/
Strict-Transport-Security: max-age=0
X-Content-Type-Options: nosniff
CF-RAY: 1fa0738914022324-FRA

However when I try the same method with Google.com or CloudFlare.com it works fine!

I'm running on OS X Yosemite (10.10.3) with OpenSSL 1.0.2c 12 Jun 2015, ruby 2.2.2p95 and rest-client 1.8.0

0

There are 0 answers