'SSLError certificate has expired while using HTTPI
I'm stuck with something I do not understand. Running either on my local instance (Mac OSX) or production server (Ubuntu 20.04+), I'm almost sure I'm not using the famous
dst root ca x3
certificate, still it does not work. Regular curl (outside of rails) gives no problem on same machine.
require 'httpi'
@endpoint = "https://maps.mail.ru/osm/tools/overpass/api/interpreter"
r = HTTPI::Request.new(url: @endpoint, body: "")
HTTPI.post(r).body
Returns:
Traceback (most recent call last):
2: from (irb):65
1: from (irb):65:in `rescue in irb_binding'
HTTPI::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired))
How can I know or get the certificate being used with Rails?
What is odd is if I do test while using
curl -Lks 'https://git.io/rg-ssl' | ruby
I got
Here's your Ruby and OpenSSL environment:
Ruby: 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
RubyGems: 3.3.5
Bundler: 2.2.32
Compiled with: OpenSSL 1.1.1g 21 Apr 2020
Loaded version: OpenSSL 1.1.1i 8 Dec 2020
SSL_CERT_FILE: /usr/local/etc/[email protected]/cert.pem
SSL_CERT_DIR: /usr/local/etc/[email protected]/certs
With that out of the way, let's see if you can connect to rubygems.org...
Bundler connection to rubygems.org: success ✅
RubyGems connection to rubygems.org: success ✅
Ruby net/http connection to rubygems.org: success ✅
Hooray! This Ruby can connect to rubygems.org. You are all set to use Bundler and RubyGems. 👌
So obviously, Rails is using something else
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
