Rails - Curb SSLCA error? - Curl::Err::SSLCACertificateError Rails - Curb SSLCA error? - Curl::Err::SSLCACertificateError curl curl

Rails - Curb SSLCA error? - Curl::Err::SSLCACertificateError


It sounds like you're using a self-signed SSL certificate on the server, which is fine. I do the same thing for internal services. You'll just want to make your client aware of the custom SSL certificate as well, that way it knows that it can be trusted.

Something like this should do the trick:

req = Curl::Easy.http_post("https://mysite.com", loginJson) do |curl|  curl.headers['Content-type'] = 'application/json'  curl.cacert = "/path/to/ca.crt"  curl.cert = "/path/to/cert.pem"end

Of course, you'll probably want to extract these string constants into a config file.


I find an alternative solution, when I request a "curl" I put this additional propriety:

 curl.ssl_verify_peer = false

I don't know if in term of security is the best solution, but for the moment it works...