R
Railway3mo ago
Yashu

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:
have your code only accept a health check made with the hostname healthcheck.railway.app and the user agent RailwayHealthCheck/1.0
Jump to solution
6 Replies
Percy
Percy3mo ago
Project ID: N/A
Brody
Brody3mo ago
if the service itself is not publicly exposed than the health check endpoint is not publicly exposed by default
Yashu
Yashu3mo ago
Yes, but what about the public services.
Solution
Brody
Brody3mo ago
have your code only accept a health check made with the hostname healthcheck.railway.app and the user agent RailwayHealthCheck/1.0
Brody
Brody3mo ago
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?
raf
raf3mo ago
just make an env variable to check... HEALTCHECK_SECRET perhaps?
Want results from more Discord servers?
Add your server