If I configure a random management port (management.server.port=0) in the eureka client's spring boot application properties, eureka calculates the statusPageUrl and healthCheckUrl with the incorrect port, i.e. not the actual management port, but the one for the default server.

I think that this is an unintended consequence of the fix for https://github.com/spring-cloud/spring-cloud-netflix/issues/2732, as the management web server initialization event is being disregarded, which it shouldn't for determining these specific urls.

I'm using the latest spring boot (2.7.5) and spring cloud (2021.0.4)

Comment From: spencergibb

To be honest, trying to support random ports at all is like a house of cards. Marking for votes.

Comment From: eroaespinosa

Same bug, bug spreads to prometheus when configured with eureka

Comment From: stefan-g

Facing the same issue. For local testing the setup i'm using is managment.server.port=0 and server.port=0. Spring boot admin can not access actuator/** resources because eureka uses wrong port (and with the wrong port a 404 "no static resource" is returned). Would be nice to have a solution for this