I’m working with Action Text / Trix and Attachments.
In development. Everything works when using Amazon S3 to upload and view attachments. When I tried using Cloudflare R2, rails uploads attachments succesfully but when reading them it gets a 404 not found.
This is my CORS setting in R2
[
{
"AllowedOrigins": [
"*"
],
"AllowedMethods": [
"PUT",
"GET",
"POST"
],
"AllowedHeaders": [
"Origin",
"Content-Type",
"Content-MD5",
"Content-Disposition"
],
"ExposeHeaders": [
"ETag"
],
"MaxAgeSeconds": 3600
}
]
The generated URL in Rails that’s gets a 404 (the same URL when using S3 works)
https://my-bucket.fe1c0a02f02ffa69fe7c257ed359ca28.r2.cloudflarestorage.com/ot8vt2wg2yu2yn9ba8d2rzblmjuj?response-content-disposition=inline; filename="ines-alvarez-fdez-u6rZ2_bUgUE-unsplash.jpg"; filename*=UTF-8''ines-alvarez-fdez-u6rZ2_bUgUE-unsplash.jpg&response-content-type=image/jpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=f541df1c638aeb55963847ed0b34173b/20250722/auto/s3/aws4_request&X-Amz-Date=20250722T132433Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=e89653c3d1e0b188285b5b87398437f046fa537ff872e2cac7a7fd16ffe93d37
I assume this is a configuration issue but I’m not sure where/how to debug.
Any ideas?