REST downloads from the S3 backend drop ETag and Cache-Control on 304 responses
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- aws, typescript
Research direction
Start with Renderer.render() and its error branch, then compare the S3 backend’s 304 handling with the file backend’s setHeaders() path and the existing S3 protocol GetObject handling. Reproduce with a stub upstream returning 304 and ETag, Cache-Control, and Last-Modified; done means the REST download’s 304 preserves the headers expected for the corresponding 200 response. Pull request #1653 is already open for this issue.
Written by the indexing model from the issue text.
Description
Bug report
With the S3 storage backend, a REST object download that revalidates with If-None-Match gets a bare 304 Not Modified. The response has no ETag, Cache-Control or Last-Modified. RFC 9110 section 15.4.5 requires a 304 to carry the ETag and Cache-Control that a 200 would have sent.
The AWS SDK throws on a 304, so Renderer.render() handles it in its error branch. That branch only sets Vary before it sends the 304. The file backend returns its 304 as a value, so it goes through setHeaders() and keeps these headers. The S3 protocol GetObject path already copies them from the SDK error's raw response.
To reproduce
- Run Storage with
STORAGE_BACKEND=s3and uploadbucket/object.txtto a public bucket. GET /object/public/bucket/object.txtand note theETag.- Send the same request with
If-None-Match: <that ETag>.
A unit test that points S3Backend at a stub upstream, which answers the conditional request with 304 plus ETag, Cache-Control and Last-Modified, gets this at upstream b74897cf:
statusCode: 304
etag: undefined
Expected behavior
The 304 carries the upstream ETag and Last-Modified, and the same Cache-Control (or signed URL Expires) that the 200 response would have. Browsers and CDNs then keep the stored validator and refresh its freshness instead of revalidating on every request.
Scope
This covers the REST renderer for downloads through the S3 backend. #1511/#1512 cover response overrides on S3 protocol 304s, and #1607 covers HeadObject conditionals.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 318
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 106
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/storage
-
S3 CreateBucket returns BucketAlreadyExists for a bucket the project already ownsPossibly taken @ferhatelmas claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
supabase/storage#1656 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
The sample application in storage article points to wrong URLMay be free again @prasadf18 claimed this 209 days ago, and no pull request is open. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 62/100
supabase/storage#557 · 1 comment ·
Maintainers usually reply within 1 day
-
TUS uploads ignore a bucket file_size_limit of 0Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Deleting a single object leaves its TUS .info sidecar in the S3 backendPossibly taken @hsusul claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
S3 UploadPartCopy failures leak reserved upload sizePossibly taken @ferhatelmas claimed this 1 day ago. Open
Difficulty 3/5 Half a day Newbie friendliness 42/100
supabase/storage#1645 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in supabase/storage
Similar issues
-
unwrapDatabaseError masks real DB errors with TypeError: Cannot convert object to primitive valueOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NEARBuilders/everything-dev#798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel-labs/durable-harness#53 ·
Maintainers usually reply within 1 day
-
[Bug]: Redesign tab bars ignore clicks on Linux: hidden chat layers keep window drag regionsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
experiência: a doc manda subir para o Micro do Supabase, mas não diz que exige plano pago nem quanto custaPossibly taken A pull request linked to this issue is open or already merged. Openarea/docs area/ui enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
melgarafael/DeskcommCRM#4098 ·
Maintainers usually reply within 1 day
-
dependencies platform: ios
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
software-mansion/react-native-executorch#1617 ·
Maintainers usually reply within 1 day