fix(hepa): strip path from Kong service URL in BuildKongServiceReq#6785
fix(hepa): strip path from Kong service URL in BuildKongServiceReq#6785luobily wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 977b84f136
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| u.Path = "" | ||
| u.RawQuery = "" | ||
| u.Fragment = "" | ||
| req.Url = u.String() |
There was a problem hiding this comment.
Preserve static redirect paths
When a manual RT_URL API uses a static RedirectPath, verifyApiCreateParams/verifyApiUpdateParams append that path to RedirectAddr, and pathAdjust only installs the path-variable rewrite plugin when the backend path contains variables. For inputs such as redirectAddr=http://upstream and redirectPath=/api, clearing u.Path here changes Kong's service URL from http://upstream/api to http://upstream, so requests are forwarded without the configured backend prefix and existing static-prefix APIs will hit the wrong upstream path.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6785 +/- ##
==========================================
- Coverage 15.82% 15.82% -0.01%
==========================================
Files 3998 3998
Lines 328174 328179 +5
==========================================
- Hits 51939 51925 -14
- Misses 270338 270354 +16
- Partials 5897 5900 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Specified Reviewers:
ChangeLog
Need cherry-pick to release versions?