Configuration

To configure the health endpoint, supply configuration through endpoints.health.

Health Endpoint Configuration Example

  1. endpoints:
  2. health:
  3. enabled: Boolean
  4. sensitive: Boolean
  5. details-visible: String (1)
  6. status:
  7. http-mapping: Map<String, HttpStatus>
1One 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

  1. endpoints:
  2. health:
  3. 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:

StatusHTTP Code

UP

OK (200)

UNKNOWN

OK (200)

DOWN

SERVICE_UNAVAILABLE (503)

You can provide custom mappings in application.yml:

Custom Health Status Codes

  1. endpoints:
  2. health:
  3. status:
  4. http-mapping:
  5. DOWN: 200

The above will return OK (200) even when the HealthStatus is DOWN.