From f20addee50997e8f272177042cc5b76c8c615a72 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Wed, 21 Feb 2024 01:46:30 -0700 Subject: [PATCH] Reverting ETag --- main.go | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/main.go b/main.go index 2140d21..997a568 100644 --- a/main.go +++ b/main.go @@ -61,32 +61,9 @@ func main() { })) e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(50))) - // Generate the deployment time when the application starts - deploymentTime := fmt.Sprintf("%d", time.Now().UnixNano()) - // Static server fs := http.FS(PublicFS) - e.GET("/public/*", func(c echo.Context) error { - // Generate an ETag based on the deployment time - eTag := fmt.Sprintf(`W/"%s"`, deploymentTime) - - // Set the ETag header - c.Response().Header().Set("ETag", eTag) - - // Set the Cache-Control header - c.Response().Header().Set("Cache-Control", "public, max-age=3600") - - // Check the file extension and set the Content-Type header accordingly - ext := filepath.Ext(c.Param("*")) - switch ext { - case ".css": - c.Response().Header().Set("Content-Type", "text/css; charset=utf-8") - case ".js": - c.Response().Header().Set("Content-Type", "application/javascript; charset=utf-8") - } - - return echo.WrapHandler(http.FileServer(fs))(c) - }) + e.GET("/public/*", echo.WrapHandler(http.FileServer(fs))) // Page routes e.GET("/", pages.Home)