oh wow ok. this is likely a smoking gun and points to a different issue.
avatar_proxy in the logs usually means discourse is refusing to serve the avatar directly from cloudflare R2 CDN. instead, discourse is aggressively intercepting the request and downloading the image from R2 to the local server’s /tmp folder, and then using ruby to serve the image to the browser. so i think this is completely bypassing the CDN and explains the 3-second delay - i suspect the server is manually fetching and loading the file on every single request ![]()
discourse uses the avatar_proxy in a few very specific scenarios and usually it is a privacy or security setting that forces the server to mask the external URL.
check these settings in admin - site settings:
find external system avatars url - if there is anything in that box (like /letter_avatar_proxy/v4/...), delete it so it is empty. that should stop discourse from proxying default letter avatars. also worth checking uploaded avatars allowed groups and make sure it says TL_0.
maybe doublecheck DISCOURSE_S3_CDN_URL to make sure it is correct without a trailing slash or typo?
remap custom avatars:
it seems likely that your database still contains the raw R2 bucket URLs instead of your new CDN URL; because they don’t match, your forum is likely proxying them for security reasons.
check in the rails console to see exactly what discourse is fighting with:
./launcher enter app
rails c
pick a username with a slow loading avatar
u = User.find_by_username("the_selected_username")
u.user_avatar.custom_upload.url
if the output returns a raw bucket URL your previous remaps didn’t catch everything (perhaps it might have missed a subdomain or a scheme).
to fix, ssh into your server, go back to your container again (not rails) (./launcher enter app), and run the remap tool (again lol) to swap the raw URL for your CDN URL:
discourse remap "https://<your-raw-cloudflare-url>.r2.cloudflarestorage.com" "https://cdn.your-domain.com"
then run it a second time using // instead of https:// just in case.
btw, just out of curiousity what host service are you using? i have the same general setup as you and i haven’t experienced this issue yet. so i’m also interested in your configuration and i want to try to reproduce it somehow.