From 3427ae75baaccd8e0981d2f0aa849fba4e4c51f5 Mon Sep 17 00:00:00 2001 From: Liu Chao <15957058+chaoliu719@users.noreply.github.com> Date: Tue, 5 Aug 2025 19:42:20 +0800 Subject: [PATCH] fix: resolve gRPC Gateway connection issue when server address is empty (#4968) Signed-off-by: ChaoLiu --- server/router/api/v1/v1.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go index 962356e96..613131adf 100644 --- a/server/router/api/v1/v1.go +++ b/server/router/api/v1/v1.go @@ -67,7 +67,11 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error { var target string if len(s.Profile.UNIXSock) == 0 { - target = fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port) + addr := s.Profile.Addr + if addr == "" { + addr = "localhost" + } + target = fmt.Sprintf("%s:%d", addr, s.Profile.Port) } else { target = fmt.Sprintf("unix:%s", s.Profile.UNIXSock) }