Skip to content

R2

  • The bucket is private: files are served through /api/cms/media/… with each collection's access rules.
  • With clientUploads (direct upload from the browser), set CORS on the bucket:
[{ "AllowedOrigins": ["https://my-site.com"], "AllowedMethods": ["PUT"], "AllowedHeaders": ["content-type", "content-disposition"], "MaxAgeSeconds": 3600 }]

wrangler r2 bucket cors set my-site-media --file cors.json