Search code examples
ruby-on-railssslhttparty

Ruby 2.5.1, Rails 5.1.6, HTTParty post returns OpenSSL error


I am running a console utility, I've tried verified:false, just to determine if its'a a client or a server issue, when I run this:


Solution

  • Given the information in the comments I seems that the client and the server can't negotiate which cryptographic protocol to use.

    In order to fix this you might need to do one of the following things:

    • You can try to use specific ssl version on the request:

      HTTParty.post(url, body: payload.to_json, ssl_version: :TLSv1)
      

    You can find all supported :ssl_versions values by using OpenSSL::SSL::SSLContext::METHODS in the rails console and try to use some of them.

    • If the server does support only SSLv3 (which is not secure), you might need to rebuild openssl with ssl3 support on your machine or if you have access to the server to set it up so it supports more secure protocols.