Can't access fly.io app via flycast from Elixir (but can from curl)

I have a app in Fly.io called skip-trace-proxy with a squid HTTP proxy running. That app is deployed with flycast meaning that I should be able to access it from other apps in the same org by calling skip-trace-proxy.flycast as the URL.

If I try doing that using curl like this:

curl -x skip-trace-proxy.flycast:3128 ifconfig.co

It works great, but, when I try using Req or Finch to call it, I get a nxdomain error:

> Req.get!("http://skip-trace-proxy.flycast:3128")
** (Req.TransportError) non-existing domain
    (req 0.5.14) lib/req.ex:1121: Req.request!/2
    iex:3: (file)

> Req.get!(
  "https://fly.io",
  connect_options: [proxy: {:http, "skip-trace-proxy.flycast", 3128, []}]
)
** (Req.TransportError) non-existing domain
    (req 0.5.14) lib/req.ex:1121: Req.request!/2
    iex:1: (file)

# FinchConfig:
#      {Finch, name: Core.ProxiedFinch, pools: %{
#         default: [
#           protocols: [:http1],
#           conn_opts: [
#             proxy: {:http, "skip-trace-proxy.flycast", 3128, []}
#           ]
#         ]
#       }},

> Finch.build(:get, "http://ifconfig.co") |> Finch.request(Core.ProxiedFinch)
{:error, %Mint.TransportError{reason: :nxdomain}}

Why is this happening?

It seems like the issue is because the flycast will be using ipv6 only, so, for a url you would enabled inet6: true, but I can’t figure out how to configure the same for the proxy to use ipv6 too.

After trying some options I found the solution, you need to setup the proxy this way:

Req.get!(
  "http://ifconfig.co",
  connect_options: [
    proxy: {:http, "skip-trace-proxy.flycast", 3128, [transport_opts: [inet6: true]]},
  ]
)