File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
components/blobserve/pkg/blobserve Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -224,14 +224,27 @@ func (reg *Server) serve(w http.ResponseWriter, req *http.Request) {
224224 return
225225 }
226226
227+ // warm-up, didn't need response content
228+ if req .Method == http .MethodHead {
229+ w .Header ().Set ("Cache-Control" , "no-cache" )
230+ w .WriteHeader (http .StatusOK )
231+ return
232+ }
233+
227234 log .WithField ("path" , req .URL .Path ).Debug ("handling blobserve" )
228235 pathPrefix := fmt .Sprintf ("/%s" , ref )
229236 if req .URL .Path == pathPrefix {
230237 req .URL .Path += "/"
231238 }
232239
233240 w .Header ().Set ("ETag" , hash )
234- w .Header ().Set ("Cache-Control" , "no-cache" )
241+
242+ inlineVarsValue := req .Header .Get ("X-BlobServe-InlineVars" )
243+ if inlineVarsValue == "" {
244+ w .Header ().Set ("Cache-Control" , "public, max-age=31536000" )
245+ } else {
246+ w .Header ().Set ("Cache-Control" , "no-cache" )
247+ }
235248
236249 // http.FileServer has a special case where ServeFile redirects any request where r.URL.Path
237250 // ends in "/index.html" to the same path, without the final "index.html".
You can’t perform that action at this time.
0 commit comments