du-it
du-it

Reputation: 3009

Why does management.server.port not work?

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?

Upvotes: 1

Views: 3005

Answers (3)

Master Slave
Master Slave

Reputation: 28519

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.

Upvotes: 0

Dirk Deyne
Dirk Deyne

Reputation: 6936

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

Upvotes: 2

Kamèl Romdhani
Kamèl Romdhani

Reputation: 370

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

Upvotes: 0

Related Questions