Prechádzať zdrojové kódy

auto update script executed

Toby Chui 1 rok pred
rodič
commit
5458c0c64f
1 zmenil súbory, kde vykonal 7 pridanie a 2 odobranie
  1. 7 2
      mod/dynamicproxy/redirection/handler.go

+ 7 - 2
mod/dynamicproxy/redirection/handler.go

@@ -30,8 +30,13 @@ func (t *RuleTable) HandleRedirect(w http.ResponseWriter, r *http.Request) int {
 		redirectTarget := rr.TargetURL
 
 		if rr.ForwardChildpath {
-			//Remove the first / in the path
-			redirectTarget += strings.TrimPrefix(r.URL.Path, "/")
+			//Remove the first / in the path if the redirect target already have tailing slash
+			if strings.HasSuffix(redirectTarget, "/") {
+				redirectTarget += strings.TrimPrefix(r.URL.Path, "/")
+			} else {
+				redirectTarget += r.URL.Path
+			}
+
 			if r.URL.RawQuery != "" {
 				redirectTarget += "?" + r.URL.RawQuery
 			}