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
r2 objects put: no way to set Cache-Control (and other object headers Wrangler supports) #786
cf r2 objects put can't set Cache-Control on an uploaded object. wrangler r2 object put --remote can, and both call the same endpoint (PUT /accounts/{account_id}/r2/buckets/{bucket_name}/objects/{object_key}).
Versions: cf 1.0.0-rc.5 (latest on npm), wrangler 4.145.0, macOS.
Cause: the published OpenAPI description for r2-put-object lists only these headers: Content-Type, Content-Length, cf-r2-jurisdiction and cf-r2-storage-class. Wrangler also sends Cache-Control, Content-Disposition, Content-Encoding, Content-Language and Expires, and the API accepts them. Because cf generates its flags from the schema, those headers can't be set.
Why it matters: objects such as a "latest" download alias or an update feed need Cache-Control: no-cache so clients don't get stale copies after a release. Without it, uploads like these can't move from Wrangler to cf.
Request: add these headers to the r2-put-object schema, or give cf a way to pass extra request headers.
Possibly related:cf r2 objects put encodes the object key with encodeURIComponent, so / is sent as %2F. The command's own help says slashes "MUST be sent literally and MUST NOT be percent-encoded". I haven't checked whether the API then stores a different key.
Activity