I tried to connect to remote server using REST method, in ruby I'm getting error as
/usr/lib/ruby/2.3.0/openssl/ssl.rb:315:in `post_connection_check': hostname "ip" does not match the server certificate (OpenSSL::SSL::SSLError)
from /usr/lib/ruby/2.3.0/net/http.rb:944:in `connect'
from /usr/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
from /usr/lib/ruby/2.3.0/net/http.rb:852:in `start'
from /var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
from /var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
from /var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
from /var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient.rb:71:in `post'
this error occurred from the below line of code
require 'rest-client'
response = RestClient.post(url, data, content_type: ctype)
I tried connecting to server using the openssl from command line as follows I was able to connect to the server
openssl s_client -connect ip:port
How to solve this error as I am using ruby only. ( not rails ) please help me. Thanks in advance.