From 6be520ca84ca744ebec00e3015c192c19e89bd9f Mon Sep 17 00:00:00 2001 From: Simon Marsh Date: Thu, 30 Dec 2021 09:59:53 +0000 Subject: [PATCH] Add static resource cache-control headers --- frontend/webserver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/webserver.go b/frontend/webserver.go index eacf303..46dc401 100644 --- a/frontend/webserver.go +++ b/frontend/webserver.go @@ -214,7 +214,10 @@ func webServerStart(l net.Listener) { } fs := http.FileServer(http.FS(subfs)) - http.Handle("/static/", fs) + http.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Cache-Control", "public, max-age=86400") + fs.ServeHTTP(w, r) + }) http.Handle("/robots.txt", fs) http.Handle("/favicon.ico", fs)