Overview
The health endpoint provides a simple way to check if the API Gateway is operational and responding to requests.
This endpoint does not require authentication and is useful for monitoring and load balancer health checks.
Response
The current status of the service. Will be “ok” if healthy.
The git commit hash of the currently deployed version.
200 - Success
503 - Service Unavailable
{
"status" : "ok" ,
"version" : "a1b2c3d"
}
Usage Examples
curl https://dev.app.boop.it/health
Use Cases
Load Balancer Configuration
Configure your load balancer to check this endpoint:
upstream backend {
server api1.boop.network:40401 max_fails = 3 fail_timeout=30s;
server api2.boop.network:40401 max_fails = 3 fail_timeout=30s;
}
location /health {
proxy_pass http://backend;
proxy_connect_timeout 1s ;
proxy_read_timeout 1s ;
}
Monitoring Script
#!/bin/bash
while true ; do
if ! curl -f -s http://localhost:40401/health > /dev/null ; then
echo "Service unhealthy at $( date )"
# Send alert
fi
sleep 10
done
Docker Health Check
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD curl -f http://localhost:40401/health || exit 1