mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
Disable cache-control header on nocache tag
This commit is contained in:
2
image.go
2
image.go
@@ -31,6 +31,8 @@ func generate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
|
||||
// +build !nocache
|
||||
w.Header().Set("Cache-Control", "max-age=604800")
|
||||
|
||||
if err := png.Encode(w, img); err != nil {
|
||||
|
||||
2
proxy.go
2
proxy.go
@@ -9,6 +9,8 @@ import (
|
||||
|
||||
func proxy(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println(r.URL.Path, ":~", r.Header.Get("user-agent"))
|
||||
|
||||
// +build !nocache
|
||||
w.Header().Set("Cache-Control", "max-age=604800")
|
||||
|
||||
src := r.URL.Query().Get("src")
|
||||
|
||||
@@ -275,7 +275,9 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
templateMapping[typ] = "other.html"
|
||||
}
|
||||
|
||||
// +build !nocache
|
||||
w.Header().Set("Cache-Control", "max-age=604800")
|
||||
|
||||
if err := tmpl.ExecuteTemplate(w, templateMapping[typ], params); err != nil {
|
||||
log.Error().Err(err).Msg("error rendering")
|
||||
return
|
||||
|
||||
@@ -67,7 +67,9 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
|
||||
"lastNotes": renderableLastNotes,
|
||||
}
|
||||
|
||||
// +build !nocache
|
||||
w.Header().Set("Cache-Control", "max-age=604800")
|
||||
|
||||
if err := tmpl.ExecuteTemplate(w, templateMapping["relay"], params); err != nil {
|
||||
log.Error().Err(err).Msg("error rendering")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user