From 03565e4fbcf6510d6b081f7d313055fdaeb69a5c Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:54:02 -0400 Subject: [PATCH] cache media --- cmd/ui/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/ui/main.go b/cmd/ui/main.go index e564c5f..140c53a 100644 --- a/cmd/ui/main.go +++ b/cmd/ui/main.go @@ -50,6 +50,8 @@ func Run(ctx context.Context, args []string) error { Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(r.URL.Path, "/media/") { http.StripPrefix("/media/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Cache-Control", "private, max-age=31536000") + w.Header().Add("Cache-Control", "immutable") http.FileServer(http.Dir(*d)).ServeHTTP(w, r) })).ServeHTTP(w, r) return