diff --git a/backend/app/dto/response/nginx.go b/backend/app/dto/response/nginx.go index 7f349726f..867b4a70b 100644 --- a/backend/app/dto/response/nginx.go +++ b/backend/app/dto/response/nginx.go @@ -36,15 +36,16 @@ type NginxAntiLeechRes struct { } type NginxRedirectConfig struct { - WebsiteID uint `json:"websiteID"` - Name string `json:"name"` - Domains []string `json:"domains"` - KeepPath bool `json:"keepPath"` - Enable bool `json:"enable"` - Type string `json:"type"` - Redirect string `json:"redirect"` - Path string `json:"path"` - Target string `json:"target"` - FilePath string `json:"filePath"` - Content string `json:"content"` + WebsiteID uint `json:"websiteID"` + Name string `json:"name"` + Domains []string `json:"domains"` + KeepPath bool `json:"keepPath"` + Enable bool `json:"enable"` + Type string `json:"type"` + Redirect string `json:"redirect"` + Path string `json:"path"` + Target string `json:"target"` + FilePath string `json:"filePath"` + Content string `json:"content"` + RedirectRoot bool `json:"redirectRoot"` } diff --git a/backend/app/service/website.go b/backend/app/service/website.go index c127bac08..88332b3ad 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -2233,9 +2233,11 @@ func (w WebsiteService) GetRedirect(id uint) (res []response.NginxRedirectConfig if strings.HasSuffix(dirParams[1], "$request_uri") { redirectConfig.KeepPath = true redirectConfig.Target = strings.TrimSuffix(dirParams[1], "$request_uri") + redirectConfig.RedirectRoot = false } else { redirectConfig.KeepPath = false redirectConfig.Target = dirParams[1] + redirectConfig.RedirectRoot = redirectConfig.Target == "/" } } }