You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Honor origin agent cache headers and edge TTL - #86
Orkuncakilkaya
changed the title
fix: add applyAgentCacheHeaders to handle edge TTL and cache headers
Honor origin agent cache headers and edge TTL
Sep 24, 2026
The etag !== null guard prevents the wildcard form from being honored when the selected representation has no ETag. If-None-Match: * matches any existing representation for a conditional GET/HEAD, so a cache hit without an ETag incorrectly returns 200 instead of 304; handle * independently of the ETag comparison.
Parse quoted Cache-Control values before filtering directives
src/utils/agentCacheHeaders.ts:33
Splitting Cache-Control on every comma does not respect quoted extension values. For example, the valid header foo="a,s-maxage=10", max-age=60 is split so that part of the quoted value is mistaken for the real s-maxage directive and removed, leaving a corrupted header. Parse commas only when they are outside quoted strings before filtering directives.
Handle If-None-Match wildcard without requiring an ETag
src/utils/agentCacheHeaders.ts:46
If-None-Match: * matches any existing representation even when that representation has no ETag. Requiring etag !== null here makes a cached 2xx response without an ETag return 200 instead of 304. Handle the wildcard before applying the ETag-presence requirement.
🚀 Following releases will be created using changesets from this PR:
fastly-compute-proxy@0.4.2
Patch Changes
Updated agent endpoint response to reset age and drop cache-tag on cache hits, and to answer If-None-Match with 304 (c186ae8)
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent cache headers: before and after
Services to test (staging,
procdn.fpjs.sh):main): fpjs-cache-test-orkun-main.edgecompute.appTest results
s-maxage, noage,cache-tagage: 1age,cache-tagkept*s-maxage,age: 0, nocache-tagage: 1age: 0, nocache-tagmax-age**s-maxage,age: 0, nocache-tagage: 1If-None-Matchs-maxage,age: 0, nocache-tagageage: 0s-maxage.cache-tagonly on its own cache misses. The proxy keeps it on misses.What changed
--enable-http-cacheageon missageon hit0cache-tagon hitIf-None-Matchon hitIf-None-Matchon upstream errorIf-None-Matchlists,*, commas in tagsWhy
agewould reach browsers. Hits needage: 0so browsers keep the agent for the fullmax-age.cache-tagis the upstream CDN's purge tag. It isn't exposed on hits.If-None-Matchon hits.