I can't upload photo after setting Cloudflare R2

Hello everyone, thanks for your time.

After setting Cloudflare R2 on my discourse, I can’t upload photo in creating topic, here is my setting:

I confirm I use the Account API Tokens(it’s active), not User API Tokens. Permission is Object Read & Write.

And I have set custom domain for the uploads bucket, it’s active:

And set the CORS Policy:

But I can’t upload photos after setting all above. Anyone can help to solve it? Many thanks!

here is custom domain and CORS setting

hi @haha :waving_hand: welcome :slight_smile:

  1. you should set the region to US East (N. Virginia):

  1. does your CORS policy on cloudflare via json looks like this? you need the ETag exposed header.
[
  {
    "AllowedOrigins": [
      "https://forum.example.com" 
    ],
    "AllowedMethods": [
      "GET",
      "PUT",
      "POST",
      "DELETE",
      "HEAD"
    ],
    "AllowedHeaders": [
      "*"
    ],
    "ExposeHeaders": [
      "ETag"
    ],
    "MaxAgeSeconds": 3000
  }
]

btw, you should follow this documentation here exactly: Configure an S3 compatible object storage provider for uploads

hi, my CORS policy is same as yours. After setting S3 region to N. Virginia, it works! Thanks for your advice!

I tried some regions except Virginia, all failed. Only Virginia works. This is a tricky point, as I found other document didn’t highlight this, they said “choose a nearest region is OK”. But experiment proves only Virginia is the right choice!

Thanks!