mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-10 11:40:53 +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
|
||||
directives := config.Directives
|
||||
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
|
||||
}
|
||||
location.UpdateDirective("proxy_pass", []string{req.ProxyPass})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue