Allow specifying separate port for health check
I have the following settings of the proxy in kamal.yaml file
proxy:
app_port: 8080
response_timeout: 10
healthcheck:
interval: 3
path: /health
timeout: 3
Usually, the "management" (a.k.a observability - health, metrics, prometheus etc.) endpoints are served on a different port not exposed to outside world, e.g. 8181
Could you please add another property to specify different port for the health check, so we end up with
proxy:
app_port: 8080
response_timeout: 10
healthcheck:
interval: 3
path: /health
port: 8181 # the new shiny property
timeout: 3
@djmb I can implement this if you are okay to adding this.
Even though I agree such feature could be useful, I want to note - last time I checked Kamal does the healthcheck on the IP address and not on the domain (i.e. host header is empty) so it's already hidden from the outside world - Kamal proxy only forwards domain requests. So the only thing currently needed is for your app not to return health check responses with domain requests.
As it is unclear if the current behavior is intended or simply a coincidence, it would certainly be better being able to explicitly configure it
the only thing currently needed is for your app not to return health check responses with domain requests.
I prefer configuration over coding a filter. With the port configuration I don't even need to change the firewall in my server provider.
@petromir I was wrong in my initial answer. Kamal and kamal-proxy require health check route to be exposed outside the container, as the health check functionality is implemented directly in the kamal-proxy server.
@igor-alexandrov exposing it outside of the container is not an issue, just the port as I don't want to use the one open to the public.
@igor-alexandrov any movement around this?
Unfortunately, nothing from my side due to a lack of time. I hope it will get better soon.
@petromir This is also at the kamal-proxy level, but would need to be bubbled up as an option in Kamal.
I opened a similar discussion on the kamal-proxy repo(https://github.com/basecamp/kamal-proxy/discussions/132) for an otel project I'm working on. My use case is that the app_port only accepts POST requests and the health check endpoint is on a different port.
+1 - even solace has a different health check port by default
Can be updated once https://github.com/basecamp/kamal-proxy/pull/152 is released