You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314
  1. package middleware
  2. import "net/http"
  3. // NoCache writes the proper response headers to inform
  4. // the client side not to cache the response's content.
  5. func NoCache(next http.Handler) http.Handler {
  6. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  7. w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  8. w.Header().Set("Pragma", "no-cache")
  9. w.Header().Set("Expires", "0")
  10. next.ServeHTTP(w, r)
  11. })
  12. }