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