git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/httpx/middlewarex/cache.go (about) 1 package middlewarex 2 3 import ( 4 "net/http" 5 6 "git.sr.ht/~pingoo/stdx/httpx" 7 ) 8 9 // var epoch = time.Unix(0, 0).UTC().Format(http.TimeFormat) 10 11 func NoCache(next http.Handler) http.Handler { 12 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 13 14 w.Header().Set(httpx.HeaderCacheControl, httpx.CacheControlNoCache) 15 // w.Header().Set(httpx.HeaderExpires, epoch) // for Proxies 16 17 next.ServeHTTP(w, r) 18 }) 19 }