diff --git a/backend/s3/s3_internal_test.go b/backend/s3/s3_internal_test.go index 5b68fdb08..86e23e436 100644 --- a/backend/s3/s3_internal_test.go +++ b/backend/s3/s3_internal_test.go @@ -60,6 +60,16 @@ func (f *Fs) InternalTestMetadata(t *testing.T) { // "tier" - read only // "btime" - read only } + // Cloudflare insists on decompressing `Content-Encoding: gzip` unless + // `Cache-Control: no-transform` is supplied. This is a deviation from + // AWS but we fudge the tests here rather than breaking peoples + // expectations of what Cloudflare does. + // + // This can always be overridden by using + // `--header-upload "Cache-Control: no-transform"` + if f.opt.Provider == "Cloudflare" { + metadata["cache-control"] = "no-transform" + } obj := fstests.PutTestContentsMetadata(ctx, t, f, &item, true, contents, true, "text/html", metadata) defer func() { assert.NoError(t, obj.Remove(ctx)) diff --git a/docs/content/s3.md b/docs/content/s3.md index 7be465320..6f9aef1b9 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -2388,7 +2388,14 @@ acl = private Now run `rclone lsf r2:` to see your buckets and `rclone lsf r2:bucket` to look within a bucket. -For R2 tokens with the "Object Read & Write" permission, you may also need to add `no_check_bucket = true` for object uploads to work correctly. +For R2 tokens with the "Object Read & Write" permission, you may also +need to add `no_check_bucket = true` for object uploads to work +correctly. + +Note that Cloudflare decompresses files uploaded with +`Content-Encoding: gzip` by default which is a deviation from what AWS +does. If this is causing a problem then upload the files with +`--header-upload "Cache-Control: no-transform"` ### Dreamhost