Cannot map more than one port

Hello there !

My application have 2 port exposed but I cannot get both of them map to external port
Port mapping:

Internal Port External Port
8080 80,443
9999 28080, 20443

The 8080 mapping does work but 9999 does not

Config:
app = “xxx-service”
primary_region = “yyz”

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

[[services.ports]]
handlers = [“http”]
port = 80

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

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

[[services]]
http_checks =
internal_port = 9999
processes = [“app”]
protocol = “tcp”
script_checks =
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = “connections”

[[services.ports]]
handlers = [“http”]
port = 28080

[[services.ports]]
handlers = [“tls”, “http”]
port = 20443

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


Is there something I did wrong ?

Thanks!
jhh

Looks fine to me…

I’d start an SSH shell using fly ssh shell and run wget -O- http://localhost:9999 to check that the app’s process is actually listening on port 9999 (you may need to install wget).

It might also be worth running fly ips list to check that you have a dedicated IPv4 address rather than a shared IPv4 address (which doesn’t support non-standard ports). TYPE should be “public” rather than “public (shared)”. (But fly deploy should have given you a clear error message if you had a shared IPv4.)

Thanks Tom.
I was using shared IPv4, but fly deploy does not give me error message.
May I know where is the document saying shared IPv4 does not support non-standard port?

There was an announcement, and the closest documentation is Public Network Services · Fly Docs (archive) but I agree that it is unclear. (I suggested some related doc changes but they haven’t been made.)

fly deploy used to display an error message if fly.toml contained non-standard ports and the app had a shared IPv4 address (announcement, example); maybe the error message was removed/changed, no idea if it’s intentional – might need fixing. (A random guess, since I can’t check right now: The fly.toml on which I got the error message had a single [[services]] section with public ports 80 (http), 443 (tls+http), and 5000 (http). Your fly.toml has two [[services]] sections, maybe the error checking code doesn’t detect that case. If so, it might need to be fixed.)

1 Like

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