mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-17 21:08:25 +08:00
Fix issue with errors when reverse proxy source text includes comments. (#8444)
Some checks are pending
SonarCloud Scan / SonarCloud (push) Waiting to run
Some checks are pending
SonarCloud Scan / SonarCloud (push) Waiting to run
Refs https://github.com/1Panel-dev/1Panel/issues/8442
This commit is contained in:
parent
0aa90e1b2d
commit
5bcbf32823
1 changed files with 15 additions and 4 deletions
|
|
@ -1768,11 +1768,22 @@ 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")
|
||||
return
|
||||
var (
|
||||
location *components.Location
|
||||
ok bool
|
||||
)
|
||||
for _, directive := range directives {
|
||||
if directive.GetName() == "location" {
|
||||
location, ok = directive.(*components.Location)
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if location == nil {
|
||||
return nil, buserr.New("ErrConfigParse")
|
||||
}
|
||||
|
||||
proxyConfig.ProxyPass = location.ProxyPass
|
||||
proxyConfig.Cache = location.Cache
|
||||
if location.CacheTime > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue