Skip to content

Instantly share code, notes, and snippets.

@wwitzel3
Created May 5, 2020 14:54
Show Gist options
  • Save wwitzel3/5d4d98a1a4832dbf38211f3c0c99f479 to your computer and use it in GitHub Desktop.
Save wwitzel3/5d4d98a1a4832dbf38211f3c0c99f479 to your computer and use it in GitHub Desktop.
no-cache-root
func frontendNoCacheMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
path := r.URL.EscapedPath()
if path == "/" {
w.Header().Set("Cache-Control", "no-cache, no-store")
}
next.ServeHTTP(w, r)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment