# I can't upload photo after setting Cloudflare R2

**URL:** https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303
**Category:** Self-hosting
**Tags:** uploads, s3, cloudflare
**Created:** [July 22, 2026, 11:09pm UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303 "2026-07-22T23:09:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![haha](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@haha](https://meta.discourse.org/u/haha)
#### Post date: [July 22, 2026, 11:09pm UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/1 "2026-07-22T23:09:40Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/5/8/658634c93dccec8e7ce4f72a20022c513282687e.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/3/f/23f82cc0b67edbc69c88a3b0c89ec82b156aad33.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/c/8/dc8d84c3581444eecb3b579654c5d197b134c6b6.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/3/4/9341342e3f206242a99c0e8707808a5cb216c685.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/e/6/3e668b94535c190f1992e06823ecde5703e7a81f.png)

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!

---

<div class="post-metadata">

### Author: ![haha](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@haha](https://meta.discourse.org/u/haha)
#### Post date: [July 22, 2026, 11:11pm UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/2 "2026-07-22T23:11:21Z")

</div>

here is custom domain and CORS setting

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/2/c/42ced75c4eeb241dec7ce4b0dd42a20f1b14062c.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/b/b/6bbbe7a5fab5bb15c2209a4f0699fcd358018d2d.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [July 23, 2026, 12:00am UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/3 "2026-07-23T00:00:40Z")

</div>

hi @haha 👋 welcome 🙂

> ![IMG_0144](https://global.discourse-cdn.com/meta/original/4X/f/1/b/f1b958888a94a42d3489f115c1e3df1d43ce0d76.jpeg)

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

 ![Screenshot 2026-07-22 at 4.59.31 PM](https://global.discourse-cdn.com/meta/original/4X/2/1/b/21b4dffb84333dd3e2bb325237b038237dfb248b.png)

1. does your CORS policy on cloudflare via json looks like this? you need the `ETag` exposed header.

```plaintext
[
  {
    "AllowedOrigins": [
      "https://forum.example.com" 
    ],
    "AllowedMethods": [
      "GET",
      "PUT",
      "POST",
      "DELETE",
      "HEAD"
    ],
    "AllowedHeaders": [
      "*"
    ],
    "ExposeHeaders": [
      "ETag"
    ],
    "MaxAgeSeconds": 3000
  }
]

```

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [July 23, 2026, 12:06am UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/4 "2026-07-23T00:06:15Z")

</div>

btw, you should follow this documentation here exactly: [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/-/148916#p-738234-cloudflare-r2-13)

> [@Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916/1):
>
> Cloudflare R2 is compatible with S3 object storage when using Cloudflare CDN. Cloudflare’s [free plan offers 10GB of storage](https://www.cloudflare.com/plans/#developer-platform/storage) which should be more than plenty for most forums’ needs.
> 
> To configure Cloudflare R2, you will need to configure the relevant settings in the Cloudflare dashboard under R2 Object Storage.

---

<div class="post-metadata">

### Author: ![haha](https://avatars.discourse-cdn.com/v4/letter/h/59ef9b/32.png) [@haha](https://meta.discourse.org/u/haha)
#### Post date: [July 23, 2026, 11:04am UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/5 "2026-07-23T11:04:56Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 22, 2026, 11:05am UTC](https://meta.discourse.org/t/i-cant-upload-photo-after-setting-cloudflare-r2/408303/6 "2026-08-22T11:05:15Z")

</div>

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