Can I serve http and https on the same port? Something like
[[services]]
internal_port = 42069
protocol = "tcp"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 42069
[[services.ports]]
handlers = ["tls", "http"]
port = 42069
When I do this, it seems like http (not https) doesn’t work.
For our Fly app, we do so by terminating TLS ourselves. That is Fly proxies raw TCP/UDP, and the app takes it from there. A complication is, you’d have to handle http/1.1 and http/2 both cleartext and TLS (which, depending on the reverse proxy or runtime or framework you use, is either tricky or easy). http/3 (which doesn’t have a cleartext mode) won’t work without a lot of effort anyway.
As for does Fly support both TLS and cleartext over the same port? I doubt it. Ping / wait for a Fly eng to answer this one.