From c9db350cbcd9d02b00f87a92bd8e9efb3c81ff7c Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 7 Nov 2025 16:16:58 +0800 Subject: [PATCH] fix(route): add workaround for WebUI rule preset loading in validateRules function - Introduced a temporary fix for loading the "webui.yml" rule preset when the container image is "godoxy-frontend". - Added error handling for cases where the rule preset is not found. - Marked the change with a FIXME comment to investigate the underlying issue in the future. --- internal/route/route.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/route/route.go b/internal/route/route.go index 534ddb84..3f67b194 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -310,6 +310,21 @@ func (r *Route) validate() gperr.Error { } func (r *Route) validateRules() error { + // FIXME: hardcoded here as a workaround + // there's already a label "proxy.#1.rule_file=embed://webui.yml" + // but it's not working as expected sometimes. + // TODO: investigate why it's not working and fix it. + if cont := r.ContainerInfo(); cont != nil { + if cont.Image.Name == "godoxy-frontend" { + rules, ok := rulepresets.GetRulePreset("webui.yml") + if !ok { + return errors.New("rule preset `webui.yml` not found") + } + r.Rules = rules + } + return nil + } + if r.RuleFile != "" && len(r.Rules) > 0 { return errors.New("`rule_file` and `rules` cannot be used together") } else if r.RuleFile != "" {