Recommended way to make health check endpoint private
What is the recommended way from Railway to make health check endpoint only avaiable to Railway and not publicly accessible.
I have some private services which are not publicly exposed/accessible.
Solution:Jump to solution
have your code only accept a health check made with the hostname
healthcheck.railway.app
and the user agent RailwayHealthCheck/1.0
6 Replies
Project ID:
N/A
if the service itself is not publicly exposed than the health check endpoint is not publicly exposed by default
Yes, but what about the public services.
Solution
have your code only accept a health check made with the hostname
healthcheck.railway.app
and the user agent RailwayHealthCheck/1.0
set a query parameter secret in the health check and have your code only answer if its the correct query param.
but i have to ask, why does it matter if the health check is public? does it make some kind of heavy database call?
just make an env variable to check... HEALTCHECK_SECRET perhaps?