repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
d39dc39
parent
98e7f62
author
Eric Bower
date
2026-01-16 21:35:18 -0500 EST
refactor(pgs): cache-control max-age and revalidate

We want to prevent the browser from caching stale static pages by requiring it to revalidate using ETag after 1 minute.
1 files changed,  +3, -0
M pkg/apps/pgs/web_asset_handler.go
+3, -0
 1@@ -267,6 +267,9 @@ func (h *ApiAssetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 2 		}
 3 	}
 4 
 5+	// Default cache: short TTL then must revalidate using ETag
 6+	w.Header().Set("cache-control", "max-age=60, must-revalidate")
 7+
 8 	for _, hdr := range userHeaders {
 9 		w.Header().Add(hdr.Name, hdr.Value)
10 	}