I get this error with both :httpc and HTTPoison.get. Here’s HTTPoison:
iex(1)> HTTPoison.get! "https://grad.tamu.edu/"
22:15:54.179 [notice] TLS :client: In state :certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA
** (HTTPoison.Error) {:tls_alert, {:unknown_ca, ~c"TLS client: In state certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA\n"}}
(httpoison 2.2.0) lib/httpoison/base.ex:451: HTTPoison.request!/5
iex:1: (file)
Same with this:
iex(1)> :httpc.request(:get, {'https://grad.tamu.edu/', []}, [], [])
22:24:10.836 [notice] TLS :client: In state :certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA
{:error,
{:failed_connect,
[
{:to_address, {~c"grad.tamu.edu", 443}},
{:inet, [:inet],
{:tls_alert,
{:unknown_ca,
~c"TLS client: In state certify at ssl_handshake.erl:2138 generated CLIENT ALERT: Fatal - Unknown CA\n"}}}
]}}
.tool-versions:
elixir 1.15.2-otp-26
erlang 26.0.2
I’ve seen this pop up periodically over the years. What’s the root cause?
I’m thinking of making an elixir lib that simply shells out to curl
, which has no problems:
$ curl --head https://grad.tamu.edu/
HTTP/2 200
cache-control: private
content-length: 46798
content-type: text/html; charset=utf-8
server: Microsoft-IIS/10.0
x-aspnetmvc-version: 5.2
x-aspnet-version: 4.0.30319
x-powered-by: ASP.NET
date: Wed, 15 Nov 2023 05:20:20 GMT
strict-transport-security: max-age=4294967294
EDIT: I made this dead simple Hex Package.
CurlEx.get!(url)