SSLCaertBadFile error heroku curb

五迷三道 提交于 2019-12-07 06:03:16

It is a bad idea to disable certificate checking. See http://www.rubyinside.com/how-to-cure-nethttps-risky-default-https-behavior-4010.html, http://jamesgolick.com/2011/2/15/verify-none..html and associated references for more on that topic.

The issue is that your HTTP client doesn't know where to find the CA certificates bundle on heroku.

You don't mention what client you are using, but here is an example for using net/https on heroku:

require "net/https"
require "uri"

root_ca_path = "/etc/ssl/certs"

url = URI.parse "https://example.com"
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.scheme == "https")

if (File.directory?(root_ca_path) && http.use_ssl?)
  http.ca_path = root_ca_path
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  http.verify_depth = 5
end

request = Net::HTTP::Get.new(url.path)
response = http.request(request)

Here is an example using Faraday:

Faraday.new "https://example.com", ssl: { ca_path: "/etc/ssl/certs" }

Good luck.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!