[mirror] Scalable static site server for Git forges (like GitHub Pages)

Add a Vary header when content negotiation happens

Without this, if a cache first sees a compressed version of the request,
it will return that for potentially any future requests, even if they
don't request compression.

Changed files
+2
src
+2
src/pages.go
··· 216 216 // we only offer `/.git-pages/archive.tar` and not the `.tar.gz`/`.tar.zst` variants 217 217 // because HTTP can already request compression using the `Content-Encoding` mechanism 218 218 acceptedEncodings := ParseAcceptEncodingHeader(r.Header.Get("Accept-Encoding")) 219 + w.Header().Add("Vary", "Accept-Encoding") 219 220 negotiated := acceptedEncodings.Negotiate("zstd", "gzip", "identity") 220 221 if negotiated != "" { 221 222 w.Header().Set("Content-Encoding", negotiated) ··· 327 328 328 329 var offeredEncodings []string 329 330 acceptedEncodings := ParseAcceptEncodingHeader(r.Header.Get("Accept-Encoding")) 331 + w.Header().Add("Vary", "Accept-Encoding") 330 332 negotiatedEncoding := true 331 333 switch entry.GetTransform() { 332 334 case Transform_Identity: