From 365fc40dfec03411d3d8231090495761e012c525 Mon Sep 17 00:00:00 2001 From: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:49:18 +0800 Subject: [PATCH] fix: static page to limit request method (#7745 close #7667) --- server/static/static.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/static/static.go b/server/static/static.go index ec16014c..d5d6ff68 100644 --- a/server/static/static.go +++ b/server/static/static.go @@ -102,6 +102,10 @@ func Static(r *gin.RouterGroup, noRoute func(handlers ...gin.HandlerFunc)) { } noRoute(func(c *gin.Context) { + if c.Request.Method != "GET" && c.Request.Method != "POST" { + c.Status(405) + return + } c.Header("Content-Type", "text/html") c.Status(200) if strings.HasPrefix(c.Request.URL.Path, "/@manage") {