Can't upload via link from an r2 URL

I have been migrating from Google Cloud and this worked fine with Google Cloud storage, but when I upload a file to R2, then try to use the “upload via link” feature with the URL in R2, I get the following error:

Error posting to Cloudflare: 400 { "result": null, "success": false, "errors": [ { "code": 10010, "message": "Invalid URL: The URL is invalid or does not respond to requests. Refer to the response for more information or verify the URL and try again." } ], "messages": [ { "code": 10010, "message": "Performed a HTTP HEAD and HTTP GET range request, could not determine the size of the file. Please make sure your origin supports HEAD or GET range requests." } ]}"

I have verified that the video exists at the URL I am giving it, I can literally copy the URL from the logs and paste it into my browser to see that it is there.

Any ideas?

Are you using an r2.dev bucket link or have you mapped a domain name to the bucket? Public buckets · Cloudflare R2 docs

On our dev environment, there is no mapped domain and it doesn’t work. On production, we have a mapped domain and it also doesn’t work.

Is one or the other supposed to work better for this?

We believe both approaches should work, once configured. But I’m going to test it out and want to replicate your setup as closely as possible.

For using an r2.dev domain, do make sure it is enabled for public access per Public buckets · Cloudflare R2 docs (sounds like you’ve already done this, but wanted to confirm)

For the custom domain, do you have any security, bot management, or WAF rules that may block automated traffic from being able to fetch the URL?

Yes, they are public, I can paste the URL into my browser and view it on R2.

And no security.

I was able to get Stream to fetch a video from an R2 bucket of mine, both with its r2.dev link and with a custom domain. (Although the first attempt with a custom domain didn’t work because I ran into a WAF rule of my own, but worked fine once I disabled that.) I’ll DM you for a followup.

To future forum archaeologists: we solved this message in direct message. The issue was implementation specific. Stream can fetch via URL from R2, provided either of the two earlier flows are configured: either the r2.dev public bucket URL is turned on (watch out for rate limiting, if that’s gonna get heavy use) or a custom domain of your own mapped to the bucket (watch out for WAF, security level, bot management, etc. that may block automated traffic from downloading files).

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