~emersion/drmdb

0d92abfa325b0190f43affd9a886912d5e4a7fe9 — Simon Ser 3 months ago a1d07d1
Enable cache header
1 files changed, 9 insertions(+), 0 deletions(-)

M server.go
M server.go => server.go +9 -0
@@ 472,5 472,14 @@ func New() *echo.Echo {

	e.Static("/assets", "public/assets")

	e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(ctx echo.Context) error {
			if ctx.Request().Method == http.MethodGet {
				ctx.Response().Header().Set("Cache-Control", "public, max-age=3600")
			}
			return next(ctx)
		}
	})

	return e
}