write no cache header
This commit is contained in:
parent
20c9986a0a
commit
389b15f9cf
1 changed files with 6 additions and 0 deletions
|
@ -234,6 +234,8 @@ func (s *Server) routeLogs(w http.ResponseWriter, r *http.Request) bool {
|
|||
|
||||
if (request.time.year != "" && request.time.month != "") && (request.time.year < currentYear || (request.time.year == currentYear && request.time.month < currentMonth)) {
|
||||
writeCacheControl(w, r, time.Hour*8760)
|
||||
} else {
|
||||
writeCacheControlNoCache(w, r)
|
||||
}
|
||||
|
||||
if request.responseType == responseTypeJSON {
|
||||
|
@ -329,6 +331,10 @@ func writeCacheControl(w http.ResponseWriter, r *http.Request, cacheDuration tim
|
|||
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%.0f", cacheDuration.Seconds()))
|
||||
}
|
||||
|
||||
func writeCacheControlNoCache(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-cache")
|
||||
}
|
||||
|
||||
func writeRaw(cLog *chatLog, code int, w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(code)
|
||||
|
|
Loading…
Add table
Reference in a new issue