s3-proxy: expose x-amz-restore header via CORS - #4953
Merged
Conversation
Add x-amz-restore to Access-Control-Expose-Headers so browser JS can read S3 object restore (Glacier rehydration) state from cross-origin HEAD responses.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4953 +/- ##
=======================================
Coverage 46.50% 46.50%
=======================================
Files 832 832
Lines 34090 34090
Branches 5833 5833
=======================================
Hits 15854 15854
Misses 16237 16237
Partials 1999 1999
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nl0
approved these changes
Jun 9, 2026
1 task
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
x-amz-restoretoAccess-Control-Expose-Headersins3-proxy/nginx.conf, so browser JS can read S3 object restore (Glacier rehydration) state from cross-origin HEAD responses.Split out from #4921 (Glacier rehydration UX).
s3-proxyis a separately built and deployed component from the catalog bundle, so this is kept as its own independently reviewable, revertable, and deployable PR.Test plan
x-amz-restoreis readable from the browser.Greptile Summary
This PR adds
x-amz-restoreto theAccess-Control-Expose-Headerslist in the s3-proxy nginx configuration, enabling browser JavaScript to read the Glacier rehydration/restore status from cross-origin HEAD responses.x-amz-restoreto the existing comma-separated expose-headers list in the S3-proxyinglocationblock.Access-Control-Expose-Headersfrom upstream S3 responses viaproxy_hide_header(line 59), so there is no risk of duplicate headers.Confidence Score: 5/5
This is a safe, purely additive one-line change to the CORS expose-headers list with no functional side effects.
The change appends one well-known, read-only Amazon S3 response header (x-amz-restore) to the existing expose list. It does not alter any routing, authentication, or proxying logic. The existing proxy_hide_header directives already prevent duplicate headers from upstream, so the addition slots in cleanly.
No files require special attention.
Important Files Changed
x-amz-restoretoAccess-Control-Expose-Headers; change is minimal, correct, and consistent with the existing header stripping (proxy_hide_header) that prevents duplicates.Sequence Diagram
sequenceDiagram participant Browser participant s3-proxy (nginx) participant S3 (amazonaws.com) Browser->>s3-proxy (nginx): HEAD /bucket.s3.amazonaws.com/key (cross-origin) s3-proxy (nginx)->>S3 (amazonaws.com): Proxy HEAD request S3 (amazonaws.com)-->>s3-proxy (nginx): Response with x-amz-restore header Note over s3-proxy (nginx): proxy_hide_header strips upstream Access-Control-* headers Note over s3-proxy (nginx): add_header injects Access-Control-Expose-Headers (now includes x-amz-restore) s3-proxy (nginx)-->>Browser: Response with Access-Control-Expose-Headers: ..., x-amz-restore Note over Browser: JS can now read response.headers.get('x-amz-restore')Reviews (1): Last reviewed commit: "s3-proxy: expose x-amz-restore header vi..." | Re-trigger Greptile