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) {
224
224
return
225
225
}
226
226
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
+
227
234
log .WithField ("path" , req .URL .Path ).Debug ("handling blobserve" )
228
235
pathPrefix := fmt .Sprintf ("/%s" , ref )
229
236
if req .URL .Path == pathPrefix {
230
237
req .URL .Path += "/"
231
238
}
232
239
233
240
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
+ }
235
248
236
249
// http.FileServer has a special case where ServeFile redirects any request where r.URL.Path
237
250
// 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