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 is used to control whether health detail should be exposed to users who are not authenticated.
For example setting:
Using details-visible
endpoints:
health:
details-visible: ANONYMOUS
Will expose detailed information read from the various health indicators about the health status of the application to anonymous unauthenticated users.
The endpoints.health.status.http-mapping
setting can be used to control what status codes are returned 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 will return OK (200) even when the HealthStatus is DOWN.