mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-11 20:20:48 +08:00
fix: improve location retrieval in OperateProxy to handle modified nginx configs (#9901)
This commit is contained in:
parent
04a0e15899
commit
39d3b819fb
1 changed files with 10 additions and 3 deletions
|
|
@ -1632,9 +1632,16 @@ func (w WebsiteService) OperateProxy(req request.WebsiteProxyConfig) (err error)
|
||||||
|
|
||||||
config.FilePath = includePath
|
config.FilePath = includePath
|
||||||
directives := config.Directives
|
directives := config.Directives
|
||||||
location, ok := directives[0].(*components.Location)
|
|
||||||
if !ok {
|
var location *components.Location
|
||||||
err = errors.New("error")
|
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
|
return
|
||||||
}
|
}
|
||||||
location.UpdateDirective("proxy_pass", []string{req.ProxyPass})
|
location.UpdateDirective("proxy_pass", []string{req.ProxyPass})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue