Parcourir la source

In Server set headers to disable any caching.

Dmitry Chestnykh il y a 10 ans
Parent
commit
3eb958d77b
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      server.go

+ 3 - 0
server.go

@@ -43,6 +43,9 @@ func Server(imgWidth, imgHeight int) http.Handler {
 }
 }
 
 
 func (h *captchaHandler) serve(w http.ResponseWriter, id, ext string, lang string, download bool) error {
 func (h *captchaHandler) serve(w http.ResponseWriter, id, ext string, lang string, download bool) error {
+	w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	w.Header().Set("Pragma", "no-cache")
+	w.Header().Set("Expires", "0")
 	if download {
 	if download {
 		w.Header().Set("Content-Type", "application/octet-stream")
 		w.Header().Set("Content-Type", "application/octet-stream")
 	}
 	}