docs(pages): record which cache rules the edge overrides - #1203
Conversation
Two rules in this file do not reach the client as written. For responses the edge caches, any max-age below four hours is raised to four hours: /widget/* asks for one hour and /robots.txt for revalidation, and both arrive as max-age=14400. Values above four hours are untouched, which is why the day of cache on favicon.ico and logo.png does apply, and uncached responses pass through, which is why no-cache works for index.html and manifest.json. The value comes from CDN configuration and cannot be changed here. Writing max-age=0 instead of no-cache would not help either -- it is below four hours and would be raised the same way. So the note records the limit rather than pretending the rules hold. A rule that reads as applied and is not is worse than one that says where it stops.
The note explained the override and proved it on robots.txt, but the clearest evidence sits under the widget rule: /widget/v1.0.css is cached and reaches the client as max-age=14400, while /widget/v1.0 is not cached and keeps the max-age=3600 the rule asks for. Same rule, two outcomes, decided only by whether that particular response is cached -- which is the point the note is making.
|
Two review passes over two lenses — project conformity and logic/correctness — both ending at zero findings. The first pass is where the widget evidence came from: the note originally proved the override only on The verification instruction in the note was run rather than assumed: One check worth recording: One option this PR does not take. |
Follow-up to #1200, and the replacement for #1202, which was closed because its premise turned out to be wrong.
What is actually happening
Two rules in
public/_headersdo not reach the client as written. Measured against the deployed site with a cache-busting query, so none of this is a stale edge copy:cf-cache-status_headers/widget/v1.0.cssMISSpublic, max-age=3600public, max-age=14400/robots.txtMISSno-cache, must-revalidatemax-age=14400, must-revalidate/favicon.ico,/logo.pngMISSpublic, max-age=86400/static/js/<hash>.jsMISSmax-age=31536000, immutable/manifest.json,/index.htmlDYNAMICno-cache, must-revalidate/widget/v1.0DYNAMICpublic, max-age=3600The rule is not "explicit numbers get through and
no-cachedoes not". It is: for responses the edge caches, anymax-agebelow four hours is raised to four hours. Values above it are untouched, and uncached responses pass through regardless. Cloudflare documents exactly this behaviour for the browser cache TTL setting — it overrides the origin header when the origin value is lower, and the default is four hours.The two rows that show it are
/widget/v1.0.cssagainst/widget/v1.0: same rule, same asset family, different outcome purely because one is cached and the other is not.Why this is a comment and not a fix
#1202 proposed writing
public, max-age=0, must-revalidateforrobots.txt, on the theory that an explicit number would be passed through. That theory came fromfavicon.icoandlogo.png, whose86400does get through — but86400is above four hours.0is below it and would be raised to14400just asno-cacheis. The change would have looked applied while doing nothing, which is the failure this file should not contain. It was closed unmerged.The four hours come from CDN configuration, outside this repository. Nothing written in
public/_headerscan lower it. What this file can do is say so, and say how to check — so the next person reading the/widget/*rule knows that the hour it asks for is not the hour clients get, and does not spend an afternoon rediscovering it.Scope
Comment lines only. No rule, path or header value is touched — every added line starts with
#, and nothing is removed.