Skip to content

[@vercel/blob] Add useCache option to presigned get URLs - #1084

Merged
falcoagustin merged 2 commits into
mainfrom
falcoagustin/presigned-get-cache-bypass
Jul 8, 2026
Merged

falcoagustin merged 2 commits into
mainfrom
falcoagustin/presigned-get-cache-bypass

Conversation

@falcoagustin

Copy link
Copy Markdown
Collaborator

Problem

get({ useCache: false }) (restored in #1081) lets bearer-token callers bypass the CDN cache, but there was no way to get the same behavior on a presigned GET URL: presignUrl() has no cache option, so consumers of presigned URLs had to append cache=0 manually — relying on undocumented behavior.

Solution

  • Add useCache?: boolean to PresignGetUrlOptions. When false, the built URL includes cache=0 so fetches read the latest content from origin storage (x-vercel-cache: MISS, cache-control: no-store).
  • Same gating as get(): the CDN only supports the bypass for private blobs, so the param is skipped for access: 'public'.
  • The param stays outside the signed canonical string, so signatures are unchanged (unit test pins this) — meaning URL holders can still add/remove the param themselves; issuers should not treat it as an enforced restriction.
  • Verified end to end against a real private store: the bypass URL read fresh content from origin while the plain presigned URL kept serving the stale cached version.

🤖 Generated with Claude Code

When useCache: false, presignUrl appends cache=0 so fetches bypass the
CDN cache and read from origin — same gating as get() (private blobs
only). The param stays outside the signed payload, so the signature is
unchanged and URL holders can still toggle it manually.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de9f781

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vercel/blob Patch
vercel-storage-integration-test-suite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-storage-next-integration-test-suite Ready Ready Preview Jul 7, 2026 9:18pm

Request Review

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@vvo vvo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@falcoagustin
falcoagustin merged commit d0118c4 into main Jul 8, 2026
10 checks passed
@falcoagustin
falcoagustin deleted the falcoagustin/presigned-get-cache-bypass branch July 8, 2026 10:12

This branch was successfully deployed

1 active deployment
Preview — de9f7812 Deployed Jul 7, 2026 by vercel[bot]
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.

2 participants