From fe6c9b0d14d349bb7a27e672f4e810b8b860b6ac Mon Sep 17 00:00:00 2001 From: Zhang Minghan Date: Fri, 8 Mar 2024 16:35:05 +0800 Subject: [PATCH] feat: use builtin handler instead of redirect --- utils/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/config.go b/utils/config.go index 69f91307..27707c3c 100644 --- a/utils/config.go +++ b/utils/config.go @@ -105,7 +105,9 @@ func RegisterStaticRoute(engine *gin.Engine) { for _, route := range redirectRoutes { engine.Any(fmt.Sprintf("%s/*path", route), func(c *gin.Context) { path := c.Param("path") - c.Redirect(301, fmt.Sprintf("/api%s/%s", route, path)) + + c.Request.URL.Path = path + engine.HandleContext(c) }) }