default Cache-Control to no-cache

This commit is contained in:
perennial
2024-12-04 01:42:14 +11:00
parent 5df477a718
commit 10bcfeac3b
+3
View File
@@ -25,6 +25,9 @@ func RenderWithContentType[T any](w http.ResponseWriter, r *http.Request, conten
// Set strong ETag
w.Header().Set("ETag", `"`+etag+`"`)
// As a default, set Cache-Control to no-cache, which allows revalidation via ETag
w.Header().Set("Cache-Control", "no-cache")
w.WriteHeader(request_context.Get(r).RenderStatusCode)
return nil