Help: Image thumbnail is broken on chat messages

I’m using Cloudflare R2, by the way, and it works great, except for this issue.
The only issue I encounter is images attached on chat; the thumbnail is broken.

Clicking the thumbnail loads the full images correctly.

The thumbnail URL that is broken is
https://bucket.xxxxxx.r2.cloudflarestorage.com/optimized/1X/xxxxx_2_690x201.png

Which, when accessed directly, returns:

<Error>
<Code>InvalidArgument</Code>
<Message>Authorization</Message>
</Error>

Thumbnail correct URL should be:
https://r2.discourse.com/optimized/1X/xxxxx_2_690x201.png

The full image URL is
https://r2.discourse.com/original/1X/xxxxx.png

It seems for image thumbnails it uses the Cloudflare R2 endpoint API domain for some reason.

My app.yml config:

  ## Cloudflare R2
  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: auto
  DISCOURSE_S3_ACCESS_KEY_ID: xxxxx
  DISCOURSE_S3_SECRET_ACCESS_KEY: xxxxx
  DISCOURSE_S3_CDN_URL: https://r2.discourse.com
  DISCOURSE_S3_BUCKET: bucket
  DISCOURSE_S3_ENDPOINT: https://xxxxx.r2.cloudflarestorage.com
  DISCOURSE_S3_INSTALL_CORS_RULE: false
  DISCOURSE_S3_BACKUP_BUCKET: bucket/backups
  DISCOURSE_BACKUP_LOCATION: s3

Thanks, and I apologize for being a newbie on this thing.