Skip to content

Commit

Permalink
default cache and unique visits
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan13888 <29968201+Nathan13888@users.noreply.github.com>
  • Loading branch information
Nathan13888 committed Jul 21, 2021
1 parent c135495 commit 7a48234
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server.go
Expand Up @@ -151,10 +151,15 @@ func getBadge(w http.ResponseWriter, r *http.Request) {
})

date := time.Now().Add(time.Minute * -10).Format(http.TimeFormat)
expiry := time.Now().Add(time.Minute * 10).Format(http.TimeFormat)
if len(qryParam("non-unique", r, "")) > 0 {
expiry = date
w.Header().Set("Cache-Control", "no-cache,max-age=0")
}

w.Header().Set("Content-Type", "image/svg+xml")
w.Header().Set("Cache-Control", "no-cache,max-age=0")
w.Header().Set("Date", date)
w.Header().Set("Expires", date)
w.Header().Set("Expires", expiry)

w.Write(badge)

Expand Down

0 comments on commit 7a48234

Please sign in to comment.