The management.context-path adds to any existing server.context-path instead of overriding it.
application.properties configuration:server.context-path=/v1
management.context-path=/manage
The actuator resources should be present at localhost:8080/manage[actuator endpoint]
The actuator resources are located as subpath to /v1, i.e. localhost:8080/v1/manage/[actuator endpoint]
Setting the management.port=8081 does not affect the root context of the actuator resources. In other words, they will be mapped to localhost:8081/v1/manage/[actuator resource]
management.context-path=/ (in attempt to re-enable the default management context path) still results the actuator resources to be mapped to localhost:8081/v1/[actuator resource]I might have been a bit hasty labelling this as a bug. I think it's probably working as designed for all but the case where you're using a different port. When the port's the same, the actuator shares the main application's dispatcher servlet and, therefore, also shares its context path.
@wilkinsona I have just tested with the same port and with different port and The management.context-path adds to any existing server.context-path instead of overriding it in both cases.
We also just found out that the health checks on our microservices platform are not working anymore because of this issue. As a workaround we can change the actuator url but it would be nice if you can specify a different context path when you are using different server and management ports.
If the behavior's changed since 1.2.x then we need to reinstate the old behavior. If not, then we'll have to leave this as-is (for now at least).
There's a test in 7d04ca1 for the context-path behaviour in 1.2.x (confirming that there is a change in 1.3.0).
@matsev can you give that a try? (1.3.1.BUILD-SNAPSHOT coming up soon)
@snicoll Looks good from my point of view.
I have verified that:
management.context-path will be appended to any existing server.context-path if the application and the actuator have the same port configuration. management.context-path will be the root context path if the application and the actuator have different port configurations.Specifically:
server.context-path=/v1 results in :8080/v1/[application endpoint] and :8080/v1/[actuator endpoint]server.context-path=/v1 and management.context-path=/manage results in :8080/v1/[application endpoint] and :8080/v1/manage/[actuator endpoint]server.context-path=/v1 and management.port=8081 results in :8080/v1/[application endpoint] and :8081/[actuator endpoint]server.context-path=/v1, management.port=8081 and management.context-path=/manage results in :8080/v1/[application endpoint] and :8081/manage/[actuator endpoint]Thanks!
:+1:
Most helpful comment
@snicoll Looks good from my point of view.
I have verified that:
management.context-pathwill be appended to any existingserver.context-pathif the application and the actuator have the same port configuration.management.context-pathwill be the root context path if the application and the actuator have different port configurations.Specifically:
server.context-path=/v1results in:8080/v1/[application endpoint]and:8080/v1/[actuator endpoint]server.context-path=/v1andmanagement.context-path=/manageresults in:8080/v1/[application endpoint]and:8080/v1/manage/[actuator endpoint]server.context-path=/v1andmanagement.port=8081results in:8080/v1/[application endpoint]and:8081/[actuator endpoint]server.context-path=/v1,management.port=8081andmanagement.context-path=/manageresults in:8080/v1/[application endpoint]and:8081/manage/[actuator endpoint]Thanks!