diff --git a/internal/router/router.go b/internal/router/router.go index 620f37f..e0c96fb 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -2,6 +2,7 @@ package router import ( "net/http" + "os" "strings" "lmvpn/internal/handler" @@ -43,6 +44,10 @@ func Setup(r *gin.Engine) { return } + path := "./dist" + c.Request.URL.Path + if _, err := os.Stat(path); os.IsNotExist(err) { + c.Request.URL.Path = "/" + } fs.ServeHTTP(c.Writer, c.Request) c.Abort() })