From 2be1c42d916fb4c3f64e992366aa953cee4e4152 Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Sun, 29 Nov 2026 00:23:33 +0000 Subject: [PATCH] headers: specify public nature of setting cache-control --- headers.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/headers.go b/headers.go index bd9b9c6..ed18f16 100644 --- a/headers.go +++ b/headers.go @@ -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)