From a0a26f237b7144961c39fe90f3b098a080502c82 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 1 Aug 2023 18:25:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91=E8=AE=BE=E7=BD=AE=E9=87=8D=E5=AE=9A=E5=90=91=E5=88=B0?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=BD=86=E6=98=AF=E7=BC=96=E8=BE=91=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=20(#1803?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/response/nginx.go | 23 ++++++++++++----------- backend/app/service/website.go | 2 ++ 2 files changed, 14 insertions(+), 11 deletions(-) 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 == "/" } } }