Spring Cloud侧车未按预期工作

Spring Cloud侧车未按预期工作,spring,spring-cloud,netflix-eureka,netflix-zuul,spring-cloud-netflix,Spring,Spring Cloud,Netflix Eureka,Netflix Zuul,Spring Cloud Netflix,根据文档,@EnableSidecar注释充当希望在Eureka中注册的非JVM应用程序的代理。因此,要设置的配置是: sidecar: port: 81 <-- Port of the non-JVM application health-uri: http://10.135.16.50:${sidecar.port}/api/health.php <-- URI of the non-JVM application's health endpoint home-pag

根据文档,@EnableSidecar注释充当希望在Eureka中注册的非JVM应用程序的代理。因此,要设置的配置是:

sidecar:
  port: 81 <-- Port of the non-JVM application
  health-uri: http://10.135.16.50:${sidecar.port}/api/health.php <-- URI of the non-JVM application's health endpoint
  home-page-uri: http://10.135.16.50:${sidecar.port}/
然后,我们应该能够调用以下端点来访问非JVM应用程序(假设“sidecar”位于“localhost”和端口8080中):

然而,这并不像预期的那样有效。当我们请求上面的URI时,实际上会发出一个对“localhost:81”的请求,因为“sidecar”以某种方式获取其主机URI,而不是定义为sidecar属性一部分的主页URI

如果我们使用localhost在本地运行非JVM应用程序,那么一切都会按照预期工作,但这肯定不是实际的用例

因此,在我的配置中,我遗漏了什么来告诉SpringCloud(在这个特殊情况下是Zuul)使用非JVM主页uri而不是本地主机uri


感谢您的支持。

经过研究,发现sidecar必须始终部署在与非JVM应用程序相同的主机上

After some research, it turns out that the sidecar must always be deployed in the same host as the non-JVM application.

不,您可以将
sidecar.ip-address=10.135.16.50
添加到
yaml
配置文件中

我使用的是SpringBootStarter父版本是
1.5.6。发布版
工作正常

http://localhost:8080/php-sidecar/api/microservice.php
After some research, it turns out that the sidecar must always be deployed in the same host as the non-JVM application.