Add a prefix to all Spring Endpoints of the executive boot mechanism

Is there an easy way to add a prefix for all Actuator endpoints?

/env -> /secure/env /health -> /secure/health /info -> /secure/info ... 
+7
spring spring-boot spring-boot-actuator
source share
2 answers

Jesper's answer is completely correct, but I was looking for an easier way to prefix all endpoints, and this can be done using management.context-path , for example:

 management: context-path: /secure -> /secure/env -> /secure/health ... 
+17
source share

Set the endpoints.{name}.path in application.properties . For example:

 endpoints.actuator.path=/secure/actuator endpoints.env.path=/secure/env endpoints.health.path=/secure/health endpoints.info.path=/secure/info 

To enable endpoint protection, set endpoints.{name}.sensitive to true . For example:

 endpoints.health.sensitive=true 

See also Sensitive Endpoint Protection , Drive Security, and HTTP Endpoint Access Restrictions in the Spring Boot reference documentation if you want to protect the actuator endpoints of your application.

See Common Application Properties in the Spring Boot reference documentation for a list of common properties that you can set in application.properties .

+7
source share

All Articles