Skip to content

Commit 977b84f

Browse files
committed
fix(hepa): strip path from Kong service URL in BuildKongServiceReq
When SDK re-registers APIs after service redeployment, the RedirectAddr contains both host and path (e.g. http://host:8080/retail-mall/acl-web). This path was being set as Kong service.path, causing Kong to prepend it to upstream requests, resulting in 404 errors. Strip the path unconditionally so Kong service.path is always "/". This does not affect the "流量入口" (endpoint API) flow which uses its own createKongServiceReq function with AdjustRedirectAddr.
1 parent d31c282 commit 977b84f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal/tools/orchestrator/hepa/gateway/assembler/gateway_kong_assembler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package assembler
1616

1717
import (
1818
"encoding/json"
19+
"net/url"
1920
"strings"
2021

2122
"github.com/pkg/errors"
@@ -37,6 +38,12 @@ func (GatewayKongAssemblerImpl) BuildKongServiceReq(serviceId string, dto *gw.Ap
3738
}
3839
req := &providerDto.ServiceReqDto{}
3940
req.Url = dto.RedirectAddr
41+
if u, err := url.Parse(dto.RedirectAddr); err == nil && u.Host != "" {
42+
u.Path = ""
43+
u.RawQuery = ""
44+
u.Fragment = ""
45+
req.Url = u.String()
46+
}
4047
req.ConnectTimeout = 5000
4148
req.ReadTimeout = 600000
4249
req.WriteTimeout = 600000

0 commit comments

Comments
 (0)