mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-18 13:29:03 +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()
|
directives := config.GetDirectives()
|
||||||
|
|
||||||
location, ok := directives[0].(*components.Location)
|
var (
|
||||||
if !ok {
|
location *components.Location
|
||||||
err = errors.New("error")
|
ok bool
|
||||||
return
|
)
|
||||||
|
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.ProxyPass = location.ProxyPass
|
||||||
proxyConfig.Cache = location.Cache
|
proxyConfig.Cache = location.Cache
|
||||||
if location.CacheTime > 0 {
|
if location.CacheTime > 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue