diff --git a/internal/handlers/index.go b/internal/handlers/index.go index 12180e2..de1892b 100644 --- a/internal/handlers/index.go +++ b/internal/handlers/index.go @@ -165,6 +165,8 @@ func (h *BaseHandler) Index(c echo.Context) error { } } + c.Response().Header().Set("Cache-Control", "max-age=10") + return c.Render(http.StatusOK, "index.tmpl", &IndexData{ Base: &components.Base{ NavbarActive: GetPageByTitle(Pages, "Status"), diff --git a/pkg/server/routes.go b/pkg/server/routes.go index a5fe8cb..4cb3ce0 100644 --- a/pkg/server/routes.go +++ b/pkg/server/routes.go @@ -35,6 +35,12 @@ func Routes( // Server static files stat := e.Group("/static") + stat.Use(func(next echo.HandlerFunc) echo.HandlerFunc { + return func(c echo.Context) error { + c.Response().Header().Set("Cache-Control", "public, max-age=60") + return next(c) + } + }) stat.Use(middleware.StaticWithConfig(middleware.StaticConfig{ Filesystem: http.FS(static.Static), }))