今天碰到奇怪的一个问题,在将SpringBoot应用注册到eureka,通过SpringCloud Gateway访问应用时,报错500。查看Gateway日志正常,也能匹配到这个应用,就是无法访问。
解决方法:
在配置文件中添加eureka.instance.prefer-ip-address: true
eureka:
client:
serviceUrl:
defaultZone: http://10.0.64.118:9010/eureka/
#用ip注册到eureka,不使用域名
instance:
prefer-ip-address: true
本文解决了一个在SpringBoot应用通过SpringCloud Gateway访问时报错500的问题。通过在配置文件中添加eureka.instance.prefer-ip-address:true参数,使应用使用IP地址而不是域名注册到Eureka,从而解决了问题。
355





