How to set application path as actuator base path (@ApplicationPath)

49 Views Asked by At

I have enabled actuator for a spring boot application and I'm able to access it using http://localhost:8080/actuator/ --- This is working!

But I'm trying allow access using application path; For example: http://localhost:8080/my-app/actuator/

Changing the following doesn't help either.

management.endpoints.web.base-path = my-app

Accessing this URL http://localhost:8080/my-app/actuator/ --gives 404

As I'm deploying this particular application in Docker swarm behind a Spring gateway, i should allow this access.

1

There are 1 best solutions below

6
Laurent Schoelens On

I guess you should be trying to use the server.servlet.context-path property and setting it to /my-app and then remove your @ApplicationPath("/my-app")

As suggested in the documentation of management.endpoints.web.base-path property :

Base path for Web endpoints. Relative to the servlet context path (server.servlet.context-path) or WebFlux base path (spring.webflux.base-path) when the management server is sharing the main server port. Relative to the management server base path (management.server.base-path) when a separate management server port (management.server.port) is configured.