History

Set X-Cache and X-Cache-Lookup headers for cache (#8794)

X-Cache sets cache status of HIT if object is served from the disk cache, or MISS otherwise. X-Cache-Lookup is set to HIT if object was found in the cache even if not served (for e.g. if cache entry was invalidated by ETag verification)

poornas committed 6 years ago

Commit 91990331 parent 2bf6cf06 files · +50 −10Browse files

Showing the changes to cmd/api-headers.go (1 of 6 files). Show all

Unified · Split

cmd/api-headers.go+4−1
@@ -91,7 +91,10 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp · 90 unmodified lines
9191 if !objInfo.Expires.IsZero() {
9292 w.Header().Set(xhttp.Expires, objInfo.Expires.UTC().Format(http.TimeFormat))
9393 }
94−
94+ if globalCacheConfig.Enabled {
95+ w.Header().Set(xhttp.XCache, objInfo.CacheStatus.String())
96+ w.Header().Set(xhttp.XCacheLookup, objInfo.CacheLookupStatus.String())
97+ }
9598 // Set all other user defined metadata.
9699 for k, v := range objInfo.UserDefined {
97100 if HasPrefix(k, ReservedMetadataPrefix) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t