You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
652 B
Go
29 lines
652 B
Go
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
|
// Use of this source code is governed by the Parity Public License
|
|
// that can be found in the LICENSE file.
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
// unix epoch time
|
|
var epoch = time.Unix(0, 0).Format(time.RFC1123)
|
|
|
|
// http headers to disable caching.
|
|
var noCacheHeaders = map[string]string{
|
|
"Expires": epoch,
|
|
"Cache-Control": "no-cache, private, max-age=0",
|
|
"Pragma": "no-cache",
|
|
"X-Accel-Expires": "0",
|
|
}
|
|
|
|
// helper function to prevent http response caching.
|
|
func nocache(w http.ResponseWriter) {
|
|
for k, v := range noCacheHeaders {
|
|
w.Header().Set(k, v)
|
|
}
|
|
}
|