Can't access my app through <app-name>.internal domain name

I have a Phoenix app, and I’m trying to consume a REST API from another app within the same organization. According to the Fly.io documentation, I should be able to do this using https://rest-api-app-name.internal. However, when I send a GET request to this domain from my Phoenix app, I’m encountering “NXDOMAIN” errors.

Can anyone help me?

Hi Gustavo,

I recommend doing fly ssh console to a machine in your Phoenix (consuming) app and using something like dig rest-api-app-name.internal aaaa to confirm DNS resolution is working well.

If so, the most likely problem here is that your consuming Phoenix app is not using IPv6, as .internal hostnames resolve only to ipv6 (AAAA) records. Make sure you have -proto_dist inet6_tcp in ERL_AFLAGS (e.g. set in your Dockerfile’s ENV or in rel/env.sh.eex).

Cheers,

  • Daniel

Not worked :frowning:

This is my response to fly dig:

;; opcode: QUERY, status: NOERROR, id: 41620

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:

;restapi.internal. IN AAAA

;; ANSWER SECTION:

restapi.internal. 5 IN AAAA <ipv6_address_here>

and this is the line on my rel/env.sh.eex:

export ERL_AFLAGS="-proto_dist inet6_tcp"

Got any other ideas?

One thing worth mentioning: I’ve released all public IPs of the RestAPI app because this application is not intended to be publicly accessible.

Hi Gustavo,

If the name resolves correctly with dig, then the problem is in your application, and the most common reason we see in Phoenix apps (Elixir, really) is that they’re trying to resolve the name as IPv4 (A record) and not as IPv6 (AAAA record). The setting I suggested usually helps but if not, I suggest looking around for what to do when Elixir NXDOMAIN’s trying to resolve an AAAA-only name. I’ll check for other options on my side and let you know, but ideally this also helps you self-unblock :slight_smile:

  • Daniel

Another thing to try: in calls that do networky stuff, you need to pass socket_options: [:inet6] so they know to use ipv6. You know more Elixir than I do :slight_smile: in order to identify where to put this.

Cheers,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.