Unexpected UDP port exposing behaviour

I have the fly.toml shown below. My app is exposing a UDP server at port 9000 and I would expect given the configuration below my service to be listening at myawesomeapp.fly.dev:443 but in fact it is being exposed at myawesomeapp.fly.dev:9000. Is this an incorrect understanding on my part or a bug on your end?
Any insight would be greatly appreciated!

(myawesomeapp is just a placeholder and is not the actual name of my project)

app = "myawesomeapp"

SD_PORT = 9000 # My app will bind to this port

  cmd = "/myawesomeapp"
  allowed_public_ports = []
  auto_rollback = true

  protocol = "udp"
  internal_port = 9000 # My understanding is this is the port the app is listening on

    handlers = []
    port = 443 # My understanding is that this is the port that is exposed to the internet

Your understanding is right. The app must be accessible on myawesomeapp.fly.dev:443 UDP.

For UDP, make sure the app’s binding to fly-global-services (ref), and not localhost or

Btw, there’s no support for IPv6 over UDP.

1 Like

Do you know how I should proceed because my app is definitely listening on port 9000 and not 443 with the above configuration?

I have configured my app to bind to fly-global-services and my app prints the listening address on startup and it says Listening on I am aware of the lack of IPv6 support and have hardcoded the client to talk to the IPv4 address (I am really looking forward to support for IPv6 though!).

I won’t know why that is the case. You could deploy the image to a new app to see if then works? Or, destroy the current one and create another in its place?

A toy echo udp server I had running on Fly did pretty much what you describe and it worked fine. The only difference I can tell is that my toy app had the same port number exposed as it was listening on (that is, both internal_port and port were listening on the same port number; but I can’t see why different port numbers won’t work).

I can reproduce this issue on this super simple repo.

Wow, yeah, I cloned and deployed the code you shared. UDP only seems to work in “port forwarding” mode (services.internal_port and services.ports.port must be the same thing). May be, that should be in the docs as it is a bit of a head-scratcher.

cc: @thomas

1 Like

That PR is alright but given all of the documentation implies this is a valid setup, it is quite possibly a bug on Fly’s end, and unless someone from Fly can confirm that this is intentional the docs probably shouldn’t be updated.
I might reach out to Fly directly if I don’t see anything back here.

1 Like

It looks like an oversight in our docs indeed. Thanks @ignoramous for the PR!

We do not redirect ports, the actual port to reach your app over UDP is in fact the same as the internal_port.

1 Like