#StackBounty: #https #erlang #elixir #httpoison Send HTTPS get requests to same host but different host ips

Bounty: 50

I would like to send HTTPS requests to the same host but I would like to choose the target IP every time.

For example “dig digitalocean.com” shows these IPs:

digitalocean.com.   300 IN  A   104.16.110.208
digitalocean.com.   300 IN  A   104.16.112.208
digitalocean.com.   300 IN  A   104.16.109.208
digitalocean.com.   300 IN  A   104.16.113.208
digitalocean.com.   300 IN  A   104.16.111.208

With HTTP it works:

HTTPoison.get("http://104.16.110.208/", [{"host","www.digitalocean.com"}])
{:ok,
 %HTTPoison.Response{body: "", headers: [...], request_url: "http://104.16.110.208/",
  status_code: 301}}

But with HTTPS I get an error:

HTTPoison.get("https://104.16.110.208/", [{"host", "www.digitalocean.com"}])
{:error,
 %HTTPoison.Error{id: nil,
  reason: {:options, {{:server_name_indication, '104.16.110.208'}}}}}

Is there a way to achieve this with HTTPS with HTTPoison, or in Elixir/Erlang without modifying etc/hosts?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.