Map multiple external ports to different internal ones

My app provides http/s on 80/443 and does SSL termination itself based on Letsencrypt. I further need another port (SSL-terminated with custom certificate) for GRPC, say 10000.

When I deploy my app I see

Services
TCP 80/443/10000 ⇢ 80

which is obviously wrong. So what I would like to do is set internal_port per service instead of globally.

Is there a way to do that? It’s the final missing piece to migrate my applications from appfleet.com

Cheers,
Andi

1 Like

Yes this will actually work just fine! You can have multiple services, each with an internal_port and one-or-more port entries. Your services config might look like this:

[[services]]
internal_port = 8080
protocol = "tcp"

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

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

[[services]]
internal_port = 10000
protocol = "tcp"

    [[services.ports]]
    handlers = ["tls"]
    port = "10000"

The indents aren’t necessary, but helpful to show what’s happening.

1 Like

Oh yeah:

TCP 80 ⇢ 80
TCP 443 ⇢ 443
TCP 10000 ⇢ 10000

Great, much appreciated!

2 Likes