getting empty reply from tcp application hosting http while machine is starting

hi,

im trying to reduce the amount of downtime when i redeploy my app. as a simple example, i have caddy set up to bind to tcp and serve both http and https. on ports 8080 and 8443.

this is the app im using to test this. i actually for some reason can’t get proxy protocol working with health checks in this this mvp, but i can in my other app, it’s quite odd.

fly.toml

app = ''
primary_region = 'ord'

[[services]]
internal_port = 8080
protocol = "tcp"
[[services.ports]]
port = "80"

[[services.http_checks]]
  interval = 1000
  grace_period = "3s"
  method = "get"
  path = "/health"
  protocol = "http"
  timeout = 2000

[[services.tcp_checks]]
interval = 3000
timeout = 2000
grace_period = "4s"

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

[[services.ports]]
port = "443"

[[services.tcp_checks]]
interval = 3000
timeout = 2000
grace_period = "4s"

[[services.http_checks]]
  interval = 1000
  grace_period = "3s"
  method = "get"
  path = "/health"
  protocol = "https"
  tls_server_name = "149.248.200.118.sslip.io"
  timeout = 2000
  tls_skip_verify = true

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1

Caddyfile

{
  http_port 8080
  https_port 8443
  local_certs
}

149.248.200.118.sslip.io {
  respond ok
}

:8080 {
  respond ok
}

Dockerfile

FROM caddy:latest
COPY Caddyfile /etc/caddy/Caddyfile

skip verify is true because im having caddy use self signed certs so LE doesn’t get upset at me. the ip is a reserved ipv4 i just allocated.

if i relaunch this app while spamming it with requests (via the public ipv4), i notice that i get empty responses back, on both the http and https ports, iff the app is “starting” (i guess when vm is starting up or something?)

i would expect that fly would wait for a health check to succeed before routing traffic to the app, but it seems that it is not? i read: Healthcheck-based Routing which seems to imply that it should. does this have to do with direct tcp?

overall though my goal is to just have as little downtime as possible during launches.

let me know if there is any other useful information to provide or things to test

thanks!

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