Describe the bug spring-cloud-netflix-eureka-client reports wrong health-check-url , when server.servlet.context-path and eureka.instance.health-check-url-path=${server.servlet.context-path:}/myHealthCheck is set
config
eureka:
instance:
metadata-map:
management:
context-path: ${server.servlet.context-path:}/actuator
leaseRenewalIntervalInSeconds: 10
status-page-url-path: ${server.servlet.context-path:}/actuator/info
health-check-url-path: ${server.servlet.context-path:}/actuator/health
servlet:
context-path: /uaa
Issue is that if set
status-page-url-path: ${server.servlet.context-path:}/actuator/info
health-check-url-path: ${server.servlet.context-path:}/actuator/health
servlet:
context-path: /uaa
status-page-url-path is correct in eureka server http://10.42.1.114:5000/uaa/actuator but health-check-url-path is not correct in eureka server http://10.42.1.114:5000/uaa/uaa/actuator/health context-path are duplicated /uaa/uaa/
the root caused by fix https://github.com/spring-cloud/spring-cloud-netflix/issues/2702
Unit test case
@Test
public void healthCheckUrlPathWithServerPortAndContextPathKebobCase() {
TestPropertyValues.of("server.port=8989",
"server.servlet.context-path=/servletContextPath",
"eureka.instance.health-check-url-path=${server.servlet.context-path:}/myHealthCheck")
.applyTo(this.context);
setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class);
assertThat(instance.getHealthCheckUrl()
.endsWith(":8989/servletContextPath/myHealthCheck"))
.as("Wrong health check: " + instance.getHealthCheckUrl())
.isTrue();
}
Sample
Comment From: spencergibb
Closing in favor of #3809. No need to open an issue if you're just going to submit a PR to fix it