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 controls whether health detail will be exposed to users who are not authenticated.

For example, setting:

Using details-visible

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

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 returns OK (200) even when the HealthStatus is DOWN.