fix(s3): add no-transform cache-control directive to prevent payload mutation#1085
Open
adityakrmishra wants to merge 1 commit intosupabase:masterfrom
Open
fix(s3): add no-transform cache-control directive to prevent payload mutation#1085adityakrmishra wants to merge 1 commit intosupabase:masterfrom
adityakrmishra wants to merge 1 commit intosupabase:masterfrom
Conversation
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.
What kind of change does this PR introduce?
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
What is the current behavior?
When downloading HTML files via the S3-compatible API, Cloudflare's Email Address Obfuscation (Scrape Shield) intercepts and modifies the response body on the fly to hide
mailto:links. Because the origin server (Supabase) has already set theContent-Lengthheader based on the original unmutated file size, this on-the-fly mutation causes a size mismatch.Strict S3 clients like
rclonedetect that the downloaded body length does not match theContent-Lengthheader and drop the connection, failing the sync/copy operation.Fixes supabase/supabase#45584
What is the new behavior?
This PR appends the
no-transformdirective to theCache-Controlheader for S3GetObjectresponses. According to RFC 7234, this explicitly instructs intermediate proxies (like Cloudflare) not to modify the payload.By enforcing byte-for-byte fidelity,
Content-Lengthheaders remain perfectly accurate, and strict S3 clients likerclonecan copy HTML files without connection failures.Additional context
Tested locally to ensure headers merge correctly if a
Cache-Controlpolicy is already applied to the object.