Is there an easy way to add a prefix to all the Actuator endpoints?
/env -> /secure/env
/health -> /secure/health
/info -> /secure/info
...
Is there an easy way to add a prefix to all the Actuator endpoints?
/env -> /secure/env
/health -> /secure/health
/info -> /secure/info
...
Jesper's answer is completely right, but I was looking for a more straightforward way of prefixing all endpoints, and it can be done with management.context-path
, e.g.:
management:
context-path: /secure
-> /secure/env
-> /secure/health
...
According to current Spring-Boot documentation, the property to change is:
management.endpoints.web.base-path=/secure
Set the properties endpoints.{name}.path
in your 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 security on an endpoint, set endpoints.{name}.sensitive
to true
. For example:
endpoints.health.sensitive=true
See also Securing sensitive endpoints, Actuator Security and HTTP health endpoint access restrictions in the Spring Boot reference documentation if you want to secure 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
.