Simple nats server deployment can only be access through proxy

I have created a simple nats message queue with fly ( using Dockerfile ), however the service’s port can only be accessed when I use fly proxy ( through fly proxy 4222, or fly proxy 8222).

Gist:

How to reproduce:
When you use fly proxy 8222, you can check the health of the nats node using this command:
curl http://127.0.0.1:8222/routez

But it doesn’t work when I curl directly the deployment dev domain.

Hi @dzdefi!

First, NATS uses its own text-based protocol on top of TCP, so you need raw TCP proxying for port 4222. You can remove the HTTP handler from that port.

Second, have you allocated a dedicated IPv4 address for your app? Since you’re using raw TCP for port 4222 and HTTP on a non-standard port (8222), you need a dedicated IPv4 addresses for this configuration (if you want to use IPv4). You may have already allocated one, in which case, great! If not (or if you’re not sure), you can use the various fly ips subcommands.

Thanks for the detailed answer.

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