mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-24 23:04:40 +08:00
fix: 解决重定向设置重定向到首页但是编辑显示错误的问题 (#1803)
This commit is contained in:
parent
a84d8dd828
commit
a0a26f237b
2 changed files with 14 additions and 11 deletions
|
@ -36,15 +36,16 @@ type NginxAntiLeechRes struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type NginxRedirectConfig struct {
|
type NginxRedirectConfig struct {
|
||||||
WebsiteID uint `json:"websiteID"`
|
WebsiteID uint `json:"websiteID"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Domains []string `json:"domains"`
|
Domains []string `json:"domains"`
|
||||||
KeepPath bool `json:"keepPath"`
|
KeepPath bool `json:"keepPath"`
|
||||||
Enable bool `json:"enable"`
|
Enable bool `json:"enable"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Redirect string `json:"redirect"`
|
Redirect string `json:"redirect"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Target string `json:"target"`
|
Target string `json:"target"`
|
||||||
FilePath string `json:"filePath"`
|
FilePath string `json:"filePath"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
RedirectRoot bool `json:"redirectRoot"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -2233,9 +2233,11 @@ func (w WebsiteService) GetRedirect(id uint) (res []response.NginxRedirectConfig
|
||||||
if strings.HasSuffix(dirParams[1], "$request_uri") {
|
if strings.HasSuffix(dirParams[1], "$request_uri") {
|
||||||
redirectConfig.KeepPath = true
|
redirectConfig.KeepPath = true
|
||||||
redirectConfig.Target = strings.TrimSuffix(dirParams[1], "$request_uri")
|
redirectConfig.Target = strings.TrimSuffix(dirParams[1], "$request_uri")
|
||||||
|
redirectConfig.RedirectRoot = false
|
||||||
} else {
|
} else {
|
||||||
redirectConfig.KeepPath = false
|
redirectConfig.KeepPath = false
|
||||||
redirectConfig.Target = dirParams[1]
|
redirectConfig.Target = dirParams[1]
|
||||||
|
redirectConfig.RedirectRoot = redirectConfig.Target == "/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue