Different ports on spring actuator

Viewed 4527

We have following spring setup: Our application is running on port 80, but our managment.server.port is set to 8081. And we use multiple checks of the management endpoints from this secured port already.

server.port=80
management.server.port=8081
management.endpoints.web.exposure.include=*

With this settings we can hide any sensitive information from the public interface on port 80.

But now our requirements changed: We need to display the version of our application on the public interface. This information is part of the info-endpoint of our management-server on /actuator/info

Is it possible to move only the info endpoint to port 80, and let all other management.server endpoints still on 8081?

Or is there any other suitable solution for our requirement to only open the info endpoint for external calls.

We prefer to not change any firewall setting: so one port is public, and the other is internal only

1 Answers

No you can't move only one endpoint to different port. This about the actuator as an application that runs on one specific port (8081) in this case and exposes a bunch of services, so its all-or-nothing from this standpoint.

So you'll have to create a special rest controller that would read the file (or keep the memory) the data just like the info endpoint does.

Its a pretty staightforward code actually, it reads a file available in the spring boot artifact anyway and exposes its content.

You can checkout the source code of the info endpoint of the actuator here

Related