Spring Boot Actuator endpoints with set server.context-path

Łukasz Idkowiak picture Łukasz Idkowiak · Aug 21, 2015 · Viewed 9.7k times · Source

In spring boot app I set e.g. server.context-path=/mymodule. This is convenient because I don't need to repeat over and over again /mymodule prefix in @RequestMapping. Further I want to have actuator endpoints grouped together on URLs with common prefix so I set management.context-path=/actuator. Now actuator endpoint are mapped to /mymodule/actuator.

From security perspective I want to have actuator endpoints mapped to /actuator. Simple config on reverse proxy https://mydomain/api/mymodule -> http://oneofmyserver:port/mymodule protects that end users would not be able to access actuator.

Is it possible to map actuator endpoints to /actuator?

Answer

Jakub Kubrynski picture Jakub Kubrynski · Aug 21, 2015

Probably better solution from security perspective is to export actuator on totally different port. To do it just add such properties:

management.port=9080

You can also just change context-path of actuator endpoints by using

management.context-path=/actuator