1
votes

This is my curl request

`curl --insecure --location --request POST 'url' --header 'Content-Type: application/json' --data-raw '{
  "client_id": "test"
}'

This worked fine!

Now this is my elixir request

HTTPoison.post("url", request, ssl: [verify: :verify_none])

Here I am getting error

    {:error,
 %HTTPoison.Error{
   id: nil,
   reason: {:tls_alert,
    {:handshake_failure,
     'TLS client: In state certify at ssl_handshake.erl:1783 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,unable_to_match_altnames}'}}
 }}

`

1
@sbacaro Thanks! using this also I am facing the same errorVyshnavi chowdary
Forcing tls v1.2 is better than telling hackney to operate insecureSam Rose

1 Answers

1
votes

You could try to force ssl to tlsv1.2.

HTTPoison.post("url", request, ssl: [versions: [:"tlsv1.2"]])

If this not works, try to remove ssl key and/or if you are using hackney you could try to configure with insecure option.

HTTPoison.post("url", request)

HTTPoison.post("url", request, [hackney: [:insecure]])

HTTPoison.post("url", request, [ssl: [versions: [:"tlsv1.2"]], hackney: [:insecure]])

By the way, which version of Erlang are you using?

The first recommendation was discussed here.