Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ func SetRobotsTag(w http.ResponseWriter, instruction RobotIndex) {
w.Header().Add("X-Robots-Tag", string(instruction))
}

// SetCacheControl sets a private Cache-Control headers on w with the given
// SetCacheControl sets a public Cache-Control header on w with the given
// duration, rounded to seconds.
//
// A public directive marks the response as cacheable by any cache, including
// shared intermediate caches such as CDNs and reverse proxies. This is useful
// when serving static or otherwise shared content that should be cached closer
// to clients by intermediate cache layers, reducing origin traffic and
// latency. Use DisableCacheControl instead for responses that must not be
// cached.
func SetCacheControl(w http.ResponseWriter, ttl time.Duration) {
f := ttl.Seconds()
i := int(f)
Expand Down