Worker Sites / KV / Age Header Thoughts

Unfortunately this is a relatively uninformed post but I am curious after several hours of head slamming and a revelation.

Utilizing Worker sites, deployed via wrangler, with a relatively lightly modified worker (spa routing) responding with kv-asset-handler 0.0.12. Usually retrieved with this option:
options.cacheControl = { browserTTL: 600 }

I cannot detect a pattern here, but Age is sometimes supplied for a given request and sometimes not. The Age is causing absolute havoc with cache on the browser side. For example an image put into KV days ago is returning with
Age: 82902

Because of this, no matter what the browser is requesting the resource. This is occurring across every browser tested, however sometimes Age is not returned to individuals. Usually during a cache Miss.

Could anyone describe why Age is operating like this and or suggestions? To work around this issue, I’ve temporarily introduced code to reduce the age header on every response.

Any thoughts/insights would be appreciated.

Age header is for cache age not Browser age

Understood. It was my understanding that it was for proxy and informative. That’s why I ignored it for so long. Once removed however, all browsers began to cache locally.

So are you all set now? The only other thought I have is that Age might also depend on the data center, as they are all independent.

1 Like

Yes am all set for now. Caching now works browser side with cloudflare worker sites but it requires the addition of response.headers.delete('age'); otherwise the inconsistent addition of Age can cause problems.

Appreciated

1 Like

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