CORS on R2 storage


I’m trying R2 storage.
So I have some questions.
I’m trying to upload a file from a browser to R2 using the AWS JavaScript SDK.
However, the upload fails because there is no CORS header.
Is there a way to add CORS with R2 storage?

Best regards.


Hey, we would join the question as well. It’s strange that it doesn’t seem to be as easy as in the example in the R2 doc.

There was an issue on the tracker recently that might be related: Coverage of presigned URLs/presigned POST requests · Issue #4455 · cloudflare/cloudflare-docs · GitHub

FWIW I’m currently evaluating R2 with a standard app (non-worker-based) and CORS is the main blocker here (can’t use direct uploads from the browser this way).

I hope it’s on the roadmap soon.

Public buckets, custom domains on buckets, presigned URLs & a host of other things are on the roadmap but there’s no timeframe that has been committed to.

Workers are the stop-gap for the majority of these things but won’t be required when those features are natively built into R2.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.