Cloudflare R2 - images are not showing
Hey Community. I tried to use Cloudflare R2 for Data Storage but it is not working as it should be. Images uploaded in the community are stored into the bucket. That works. Problem is-> images are not shown. Anyone have a glue whats the problem?
Most probably your bucket is not public or you have provided wrong public URL in the settings. We are also using R2 in this portal.
Hey Jewel, its public access. Maybe this is the problem?
Custom Domains
Expose the contents of this R2 bucket to the internet through a custom domain. Recommended for production use.
There is no custom domain assigned to this bucket.
Public Developement URL
Expose the contents of this R2 bucket to the internet through the Public Development URL when enabled.
-> i use public developement URL, are you using the custom domain?
-
The .r2.dev domain is generally not recommended for production use due to security and branding considerations.
So when you create an R2 bucket, Cloudflare automatically assigns it a public URL using the .r2.dev subdomain.ref: https://developers.cloudflare.com/r2/platform/limits/#:~:text=For%20production%20use%20cases%2C%20connect%20a%20custom,for%20content%20served%20from%20your%20R2%20bucket
It is recommended to use a custom domain for Production enviroment. It will be also much easier for you to use your subdomain in case you will migrate your files in a future (example: from R2 to somewhere else).Note: *.r2.dev should work the same way as custom domain but still.. dont use it on a Prod site.
-
I assume you have the Public Access configured for your R2 bucket but also you have configured your public Bucket URL and it is accessible from a browser.
For troubleshooting you can:
*Purge Cache (including Cloudflare cache for the image URLs)
*Temporarily disable Rocket Loader or other Cloudflare optimization features to see if they are interfering with image loading
*Check if your CF WAF rules are blocking access to the images. Review WAF logs for potential issues
*Make sure your API keys are still valid and haven't expired
*Temporarily pause Cloudflare (Dev mode) to see if the issue is related to Cloudflare's configuration
As mentioned above... make sure you use a Public Bucket URL not the other one (common mistake).