Skip to content
Snippets Groups Projects
Commit 75f43f98 authored by Travis Ralston's avatar Travis Ralston
Browse files

Add some cache control headers

parent 5617bf56
No related branches found
No related tags found
No related merge requests found
......@@ -122,6 +122,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
"method": r.Method,
"statusCode": strconv.Itoa(http.StatusOK),
}).Inc()
w.Header().Set("Cache-Control", "private, max-age=259200") // 3 days
w.Header().Set("Content-Type", result.ContentType)
if result.SizeBytes > 0 {
w.Header().Set("Content-Length", fmt.Sprint(result.SizeBytes))
......@@ -143,6 +144,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
"method": r.Method,
"statusCode": strconv.Itoa(http.StatusOK),
}).Inc()
w.Header().Set("Cache-Control", "private, max-age=604800") // 7 days
w.Header().Set("Content-Type", "image/png")
io.Copy(w, result.Avatar)
return // Prevent sending conflicting responses
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment