Age response header field for image requests seems to cause browser caching issue


we are using CF as CDN for images served on our web site. We understood that browser is not using/or not caching images for which Age response header field value is greater than max-age value. We understand that this value is set by CF.

Below is the response header sample:

HTTP/2 200 OK
date: Thu, 24 Dec 2020 14:46:12 GMT
content-type: image/jpeg
content-length: 125224
set-cookie: __cfduid=xxx; expires=Sat, 23-Jan-21 14:46:12 GMT; path=/;; HttpOnly; SameSite=Lax
cache-control: max-age=3600
cf-bgj: imgq:85,h2pri
cf-polished: origSize=139001
x-bz-upload-timestamp: 1607634059000
x-bz-content-sha1: xxx
x-bz-file-id: xxx
x-bz-file-name: xxx.jpeg
cf-cache-status: HIT
age: 99128
accept-ranges: bytes
cf-request-id: xxx
expect-ct: max-age=604800, report-uri=“
vary: Accept-Encoding
server: cloudflare
cf-ray: xxx
X-Firefox-Spdy: h2

Image for which this response is retrieved is never retrieved from browser’s cache.

Question is how is this value calculated for image requests and can we control its creation through CF configuration, or in general how could we rectify this.

The age: 99128 response header tells you how long the file has been cached for on Cloudflare’s edge servers, in seconds.

The cache-control: max-age=3600 response header is the browser cache TTL that clients are being given - it’s currently set to 4 Hours which is our default.

Your edge cache TTL is not the same as the TTL we return to browsers, so it’s perfectly possible for your edge cache TTL to be longer than 4 hours. It really depends on what cache-control headers your origin is returning to us, or what Edge Cache TTL setting you have configured in any matching page rule.

Read for an overview.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.