did you add this line to your app.yml (or add the domain to the S3 CDN URL admin setting)?
DISCOURSE_S3_CDN_URL: https://your.R2.domain.com # (your actual R2 custom domain)
everything has to be in the correct order of operations too.
- admin/
app.ymlsettings - rake migrate
- rebake posts
there is also the string replacement tool that may help - run inside containter (swap out the strings for your specific ones):
discourse remap "https://<cloudflare-account-id>.r2.cloudflarestorage.com/<R2-bucket-name>" "https://your.cdn.domain.com"