Elixir HTTPoison getting handshake_failure {bad_cert,unable_to_match_altnames}

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}'}}
 }}

In your curl example you are using the --imsecure option. I assume the request fails is you exclude this?

If yes, the issue is not with HTTPoison. It’s doing it’s job, it’s making sure the certificate is valid which it seems to be not. It’s an issue with the server you’re sending the request to and it’s certificate.

Is there any way to ignore ssl verification in elixir?
I used ssl verify option to disable but still it’s not working

Maybe, but that would leave you wide open for all kinds of attacks SSL certificates prevent. Such as “man in the middle” attacks. I would not recommend to do so unless there is literally no other option.

one big big stupid thing I have done. Here I did not give value for headers. So this takes ssl as a header.
Thanks for help