fix: Improve config handling for proxy configuration in GetProxies (#9879)

This commit is contained in:
KOMATA 2025-08-06 16:02:27 +08:00 committed by GitHub
parent 483b47ad63
commit 3c01198e61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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