Configuration
To configure the health endpoint, supply configuration through endpoints.health
.
Health Endpoint Configuration Example
endpoints:
health:
enabled: Boolean
sensitive: Boolean
details-visible: String (1)
status:
http-mapping: Map<String, HttpStatus>
1 | One of DetailsVisibility |
The details-visible
setting controls whether health detail will be exposed to users who are not authenticated.
For example, setting:
Using details-visible
endpoints:
health:
details-visible: ANONYMOUS
exposes detailed information from the various health indicators about the health status of the application to anonymous unauthenticated users.
The endpoints.health.status.http-mapping
setting controls which status codes to return for each health status. The defaults are described in the table below:
Status | HTTP Code |
---|---|
OK (200) | |
OK (200) | |
SERVICE_UNAVAILABLE (503) |
You can provide custom mappings in application.yml
:
Custom Health Status Codes
endpoints:
health:
status:
http-mapping:
DOWN: 200
The above returns OK (200) even when the HealthStatus is DOWN.