Skip to content

gateway: no-cache on GET (fix stale web listing after upload)#48

Merged
ehsan6sha merged 2 commits into
mainfrom
fix/gateway-no-cache-listing
Jun 18, 2026
Merged

gateway: no-cache on GET (fix stale web listing after upload)#48
ehsan6sha merged 2 commits into
mainfrom
fix/gateway-no-cache-listing

Conversation

@ehsan6sha

Copy link
Copy Markdown
Member

Gateway-only fix for the web stale-listing-after-upload bug (a newly uploaded file does not show after Refresh, though it is on the server).

Root cause: the web app runs on browser fetch, which HTTP-caches GET responses. The gateway sends no Cache-Control, so the browser heuristically caches the encrypted forest index (the listing source) and serves a stale copy for minutes. Native uses reqwest (no browser cache) -- which is exactly why native refreshes instantly and web does not.

Fix: default GET responses to Cache-Control: no-cache (revalidate-always). The browser re-checks every object by ETag -- the index changes on each write so it returns 200 FRESH, while unchanged file content returns 304 (already handled) and is served from the browser cache with no re-download. Listings stay fresh AND downloads stay cached. A stored per-object cache_control still wins.

Scope: gateway-only. No SDK publish, no app rebuild. Fixes web + native + future clients. Deploy the gateway to take effect. Full rationale in the commit message.

Generated with Claude Code

ehsan6sha and others added 2 commits June 18, 2026 18:11
…eb listing)

The web app showed a STALE folder/bucket listing after an upload: it runs on
browser fetch, which heuristically HTTP-caches GET responses that carry no
Cache-Control. The forest index (the listing source) is read at an encrypted,
per-user-derived key the gateway cannot single out, so the browser served a
cached old index for minutes. Native is unaffected (reqwest has no browser
cache) -- exactly why native refreshed instantly and web did not.

Fix: default GET responses to Cache-Control: no-cache (revalidate-always). The
browser now re-checks every object via its ETag:
 - the index changes on each write -> conditional GET misses -> 200 FRESH index
   -> listing always current;
 - unchanged file content -> ETag matches -> 304 (already handled at the
   If-None-Match block) -> browser serves the cached body, NO re-download.
Listings stay fresh while downloads stay cached -- no blanket cache-disable, no
client change. A stored per-object cache_control still wins.

Gateway-only: no SDK publish, no web redeploy. Deploy the gateway to take effect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ehsan6sha ehsan6sha merged commit b7988af into main Jun 18, 2026
8 checks passed
@ehsan6sha ehsan6sha deleted the fix/gateway-no-cache-listing branch June 18, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant