From 3c01198e6131917e7c94b151a1215357c57f2bda Mon Sep 17 00:00:00 2001 From: KOMATA <20227709+HynoR@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:02:27 +0800 Subject: [PATCH] fix: Improve config handling for proxy configuration in GetProxies (#9879) --- agent/app/service/website.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/agent/app/service/website.go b/agent/app/service/website.go index a5e940eea..7f5f31dc4 100644 --- a/agent/app/service/website.go +++ b/agent/app/service/website.go @@ -1787,9 +1787,15 @@ func (w WebsiteService) GetProxies(id uint) (res []request.WebsiteProxyConfig, e } directives := config.GetDirectives() - location, ok := directives[0].(*components.Location) - if !ok { - err = errors.New("error") + var location *components.Location + for _, directive := range directives { + if loc, ok := directive.(*components.Location); ok { + location = loc + break + } + } + if location == nil { + err = errors.New("invalid proxy config, no location found") return } proxyConfig.ProxyPass = location.ProxyPass