From fd64cadc4ed8fb70192c9ec8f98fd1fdaae18f2a Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 22 Sep 2021 17:28:13 +0200 Subject: [PATCH] handle head requests --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index e1bd634..be032da 100644 --- a/main.go +++ b/main.go @@ -94,6 +94,7 @@ func main() { r.Use(cors.New(corsConfig)) r.POST("/api/claim/publish", publish) r.GET("/*url", view) + r.HEAD("/*url", view) r.MaxMultipartMemory = 8 << 20 // 8 MiB r.Run(":5000") } @@ -115,6 +116,10 @@ func view(c *gin.Context) { _ = c.AbortWithError(http.StatusBadRequest, fmt.Errorf("invalid url: %s", c.Param("url"))) return } + if c.Request.Method == http.MethodHead { + c.AbortWithStatus(200) + return + } resizeParams := "" redirectBaseURL := "https://lbry2.vanwanet.com/speech/"