Heroku Rails Net :: HTTP: OpenSSL :: SSL :: SSLError: SSL_connect returned = 1 errno = 0 state = SSLv3 read server certificate B: certificate verification failed

I have a Rails application running on a Heroku server and I am unable to contact the external server using Net :: HTTP over HTTPS. The error I get whenever I try to execute an POSTexternal proprietary API via HTTPS:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I have done quite a few hours at Googling to answer a question that I come across, but to no avail. Here is my environment:

  • Heroku Dyno launched Cedar 14 (Cedar 10 was launched, upgraded to Cedar 14 to see if this affects the problem - no joy)
  • Rails 3.2.14rc2
  • Ruby 2.1.2

"Corrections" I tried:

, , ( RVM, ), , Heroku, .

: , RVM.

, , , :

uri = URI.parse("https://api.mysite.com/api/v1")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == "https")
request = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'})
request_body = "{\"post_body\": \"data1\"}"
response = http.request(request)

- - , ?

+4
1

Heroku , , . , :

  • CA (.. )
  • , ()
  • API , Heroku CA. ()

openssl s_client -showcerts -connect your-api-host.com:443 . - :

depth=3 C = SE, O = AddTrust AB, OU = AddTrust External TTP Network, CN = AddTrust External CA Root
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Domain Validation Secure Server CA
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL, CN = www.coffeepowered.net
verify return:1

, verify return: 1. , , , , Heroku.

, API, , , , SSL. SSL Apache SSLCertificateChainFile nginx ( ).

API, " ", , ( , , , , ), , , API. , , OpenSSL, .

+3

Source: https://habr.com/ru/post/1584380/


All Articles