Download Link From R2

Answer these questions to help the Community help you get started.

What is the domain name?

Have you searched for an answer?

no

Please share your search results url:

https://[Account ID].r2.cloudflarestorage.com/[Bucket Name]/[ImageFile]

When you tested your domain using the Cloudflare Diagnostic Center, what were the results?

Describe the issue you are having:

I want to download a files from R2. And trying to use a url but it reply ‘InvalidArgument’
I want to know how to generate a url so I could use for my website images.

What error message or number are you receiving?

What steps have you taken to resolve the issue?

  1. search google
  2. check aws-sdk
  3. search to find unlimit expire time

Was the site working with SSL prior to adding it to Cloudflare?

I was useing NestJS.
It doesn’t apply SSL.

What are the steps to reproduce the error:

  1. login to your R2 dashboard
  2. Select a bucket and object
  3. copy URL and try to download to you browser

Have you tried from another browser and/or incognito mode?
I try chrome and brave browser.

That’s not the public link. The public URL should look something like:
https://pub-SOMETHING.r2.dev/ImageFile

Or you can set up Domain Access.

Setup instructions are here:

2 Likes

Thanks a lot.

For your help I could now download by url

1 Like

Yes It is important that bucket name must not involved in public url. Only file name with extension must add after public url. ex:
pub-8399113f6bdb413180d8df78083b28cc.r2.dev/bucket01/6550533895642218086.gif ---- wrong
pub-8399113f6bdb413180d8df78083b28cc.r2.dev/6550533895642218086.gif ---- correct

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