Skip to content

fix: apisix bcs-dynamic-route 插件不支持带路径后缀的集群地址#3834

Open
yuyudeqiu wants to merge 1 commit into
TencentBlueKing:masterfrom
yuyudeqiu:fix/apisix_cluster_path
Open

fix: apisix bcs-dynamic-route 插件不支持带路径后缀的集群地址#3834
yuyudeqiu wants to merge 1 commit into
TencentBlueKing:masterfrom
yuyudeqiu:fix/apisix_cluster_path

Conversation

@yuyudeqiu
Copy link
Copy Markdown
Contributor

在此之前,插件仅从集群凭证的 serverAddress 中解析 host 和 port。如果地址中包含子路径(Path),解析逻辑会忽略该路径或导致解析错误,且在转发请求给集群 APIServer 进行 URI 重写时,未包含该前缀,导致请求返回 404 Not Found。

解决方案 (Solution)

  • 增强地址解析:更新了地址拆分逻辑,支持同时提取 host:port 和路径前缀 prefix。
  • 完善凭证缓存:在动态路由缓存中增加了 prefix 字段,用于持久化存储提取到的路径前缀。
  • 优化 URI 重写逻辑:修改了 traffic_to_cluster_apiserver 函数,在代理转发前将存储的 prefix 自动拼接到 upstream_uri 中。
  • 全量修复:同步修复了 BCS 中两处受影响的插件位置:
    • bcs-services/bcs-gateway-discovery/plugins/apisix/bcs-dynamic-route.lua
    • bcs-services/bcs-bk-apisix-gateway/plugins/bcs-dynamic-route.lua

@yuyudeqiu yuyudeqiu changed the title fix(apisix): bcs-dynamic-route 插件不支持带路径后缀的集群地址 fix: apisix bcs-dynamic-route 插件不支持带路径后缀的集群地址 Apr 20, 2026
@yuyudeqiu yuyudeqiu force-pushed the fix/apisix_cluster_path branch from 8fa2534 to 2fbccde Compare April 20, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant