Home > Software engineering >  Why does management.server.port not work?
Why does management.server.port not work?

Time:09-29

I have a Spring Boot application using actuator and in the application.properties I have defined:

server.port=9090
management.server.port=10080

AFAIK the management.server.port is to expose the actuator endpoint on another port different from the application's exposed port. I would expect that both should work:

http://localhost:9090/abc
http://localhost:10080/actuator

but only http://localhost:9090/actuator works and ONLY if management.server.port is out commented.

http://localhost:10080/actuator results in an empty page in the browser. http://localhost:9090/actuator results in a white label error page with There was an unexpected error (type=Not Found, status=404). in the browser.

How can I achieve setting both, server.port and management.server.port, both returning content?

CodePudding user response:

port '10080' is blocked by your browser for security reasons (prevent NAT slipstreaming vulnerability), use another one like '9091'

CodePudding user response:

try the default health endpoint: http://localhost:10080/actuator/health

CodePudding user response:

This is a correct way to configure a new port. It works, but you're likely checking only via HTTP, and there it is not working due to what @Dirk Deyne mentioned.

But you can use the 10080 port for the actuator only you must access it via JMX. Test it with e.g. JConsole and you'll see that it is working. That is why you don't get any error messages.

  • Related