From 06af3e3014b24deb99eff143792be322e84d2501 Mon Sep 17 00:00:00 2001 From: Sonia Appasamy Date: Tue, 12 Dec 2023 15:37:24 -0500 Subject: [PATCH] client/web: only add cache header for assets Updates #10261 Signed-off-by: Sonia Appasamy --- client/web/assets.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/web/assets.go b/client/web/assets.go index 0f92d93d9..c4f4e9e3b 100644 --- a/client/web/assets.go +++ b/client/web/assets.go @@ -52,10 +52,12 @@ func assetsHandler(devMode bool) (_ http.Handler, cleanup func()) { return } - // Aggressively cache static assets, since we cache-bust our assets with - // hashed filenames. - w.Header().Set("Cache-Control", "public, max-age=31535996") - w.Header().Set("Vary", "Accept-Encoding") + if strings.HasPrefix(path, "assets/") { + // Aggressively cache static assets, since we cache-bust our assets with + // hashed filenames. + w.Header().Set("Cache-Control", "public, max-age=31535996") + w.Header().Set("Vary", "Accept-Encoding") + } http.ServeContent(w, r, path, start, fSeeker) }), nil