Skip to content

fix(hepa): strip path from Kong service URL in BuildKongServiceReq#6785

Open
luobily wants to merge 1 commit into
erda-project:masterfrom
luobily:fix/hepa-strip-kong-service-path
Open

fix(hepa): strip path from Kong service URL in BuildKongServiceReq#6785
luobily wants to merge 1 commit into
erda-project:masterfrom
luobily:fix/hepa-strip-kong-service-path

Conversation

@luobily

@luobily luobily commented Jun 10, 2026

Copy link
Copy Markdown
Member

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

Language Changelog
🇺🇸 English fix(hepa): strip path from Kong service URL in BuildKongServiceReq
🇨🇳 中文 修复创建 kong service 时,去掉 path 的设置

Need cherry-pick to release versions?

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.
@erda-bot erda-bot added bugfix hepa ingress management labels Jun 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +42 to +45
u.Path = ""
u.RawQuery = ""
u.Fragment = ""
req.Url = u.String()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.82%. Comparing base (d31c282) to head (977b84f).

Files with missing lines Patch % Lines
...r/hepa/gateway/assembler/gateway_kong_assembler.go 0.00% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
by-github-actions 15.82% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...r/hepa/gateway/assembler/gateway_kong_assembler.go 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix hepa ingress management

Development

Successfully merging this pull request may close these issues.

2 participants