diff --git a/consul/consul.go b/consul/consul.go index 638ec2f..415a137 100644 --- a/consul/consul.go +++ b/consul/consul.go @@ -58,7 +58,7 @@ func GetInstanceAddr(ctx context.Context, name string) (addr string, err error) return } //优先使用客户端IP获取实例(前后端在同一台机器调试) - addr = getInstanceAddrByIp(ctx, g.RequestFromCtx(ctx).GetRemoteIp(), service) + addr = getInstanceAddrByIp(ctx, g.RequestFromCtx(ctx).GetClientIp(), service) if !g.IsEmpty(addr) { return }