feat(lua): skip routed scripts in middleware builder

Scripts with Route config are handled by LocationEngine, so skip them
in buildLuaMiddlewares to avoid duplicate processing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-09 11:38:40 +08:00
parent fb655829e1
commit dff88449d5

View File

@ -174,6 +174,11 @@ func (s *Server) buildLuaMiddlewares(luaCfg *config.LuaMiddlewareConfig) ([]midd
// 按阶段分组脚本
phaseScripts := make(map[string][]config.LuaScriptConfig)
for _, script := range luaCfg.Scripts {
// 路由脚本由 LocationEngine 处理,跳过
if script.Route != "" {
continue
}
// 默认启用
enabled := script.Enabled
if !enabled && script.Timeout == 0 && script.Path != "" {