From be0bdf1e363584534902e395b4d632443af860a0 Mon Sep 17 00:00:00 2001 From: Rodrigo Delduca <46259+skhaz@users.noreply.github.com> Date: Thu, 16 Nov 2023 06:29:46 -0300 Subject: [PATCH] Work in progress --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 59f41cf..23b4b82 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "os" "strings" "sync" + "time" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" @@ -226,7 +227,7 @@ func javaScriptHandler(c echo.Context) error { } c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000") - c.Response().Header().Set("Vary", "Accept-Encoding") + c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat)) c.Response().Header().Set("ETag", p.Sha1()) return c.Blob(http.StatusOK, "application/javascript", runtime.Script) @@ -244,7 +245,7 @@ func webAssemblyHandler(c echo.Context) error { } c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000") - c.Response().Header().Set("Vary", "Accept-Encoding") + c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat)) c.Response().Header().Set("ETag", p.Sha1()) return c.Blob(http.StatusOK, "application/wasm", runtime.Binary) @@ -262,7 +263,7 @@ func bundleHandler(c echo.Context) error { } c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000") - c.Response().Header().Set("Vary", "Accept-Encoding") + c.Response().Header().Set("Expires", time.Now().AddDate(1, 0, 0).Format(http.TimeFormat)) c.Response().Header().Set("ETag", p.Sha1()) return c.Blob(http.StatusOK, "application/zip", bundle)