ECONNREFUSED when on single process internal service

Running into a weird problem.

I have an http server running in one app (app2.internal) I want to make requests to from another app (app1.internal) using the internal routing IP. Both apps are serving http traffic with the following services config:

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

From an ssh console inside of app1, app2.internal resolves to an IPv6 address just fine. app1 can ping app2.internal just fine.

If app1 tries to make an http request to app2.local:80, it gets a ECONNREFUSED error.

If app1 sends an an http request to app2.fly.dev:80, it works just fine.

How can I make an http request from app1 to app2 using the internal address?

Make sure app2.internal is listening on IPv6. Some frameworks only listen on IPv4 by default. You can typically pass something like :: to the listen directive to do both classes of IPs.

1 Like

Oh… ok that makes sense. Internal IP is behind the service port mapping load balancer settings. I see. I will try.