Recommended way to make health check endpoint private

2 years ago

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.

6 Replies

2 years ago

if the service itself is not publicly exposed than the health check endpoint is not publicly exposed by default


2 years ago

Yes, but what about the public services.


2 years ago

have your code only accept a health check made with the hostname healthcheck.railway.app and the user agent RailwayHealthCheck/1.0


2 years ago

set a query parameter secret in the health check and have your code only answer if its the correct query param.


2 years ago

but i have to ask, why does it matter if the health check is public? does it make some kind of heavy database call?


raflymln
TRIAL

2 years ago

just make an env variable to check… HEALTCHECK_SECRET perhaps?


Loading...