https://discord.cloudflare.com logo
Join Discord
Powered by
# r2
  • s

    Sid | R2

    03/15/2023, 2:42 AM
    If you'd be willing to create a PR to fix them, that would be appreicated! If not, I'll see if I can get someone to verify them šŸ™‚
  • v

    velek

    03/15/2023, 2:43 AM
    im not too sure what r2 is but it seems to be like file hosting or something like that? 0.015 / GB is fire
  • s

    Sid | R2

    03/15/2023, 2:43 AM
    Do you mean enabling/disabling r2.dev affects if your custom domain works or not?
  • b

    Brame

    03/15/2023, 2:44 AM
    Yeah
  • b

    Brame

    03/15/2023, 2:44 AM
    Enable r2.dev, custom domains work. Disable r2.dev status returns to ā€œNot Allowedā€
  • e

    Erisa | Support Engineer

    03/15/2023, 2:45 AM
    Yeah, you upload files to R2 and then serve them up. Similar to Amazon S3 and similar other products
  • b

    Brame

    03/15/2023, 2:47 AM
    @Sid | R2 it’s later here (UK) so i’ll jump back on here when I’m in the office tomorrow for some more support if it’s not started working by then
  • g

    GNAS

    03/15/2023, 3:25 AM
    Hi, can I limit access some bucket for R2 API Key?
  • g

    GNAS

    03/15/2023, 3:25 AM
    For now I see R2 API Key can access full bucket
  • k

    Karew

    03/15/2023, 3:25 AM
    Not currently, it's only read or write entire account atm
  • g

    GNAS

    03/15/2023, 3:28 AM
    thanks
  • v

    velek

    03/15/2023, 5:55 AM
    can i host any file on them? like .zip and jar files etc?
  • z

    zegevlier

    03/15/2023, 6:54 AM
    You can host whatever you want in terms of file type
  • t

    theompm

    03/15/2023, 6:54 AM
    That's right. I can confirm that.
  • t

    theompm

    03/15/2023, 6:56 AM
    Does anybody has experience with Apache spark reading and writing deltatables (delta.io) in production?
  • t

    theompm

    03/15/2023, 6:57 AM
    On r2 storage of course šŸ˜‹
  • e

    Eli

    03/15/2023, 11:00 AM
    Does anyone have experience generating a signed URL using the example provided in the Cloudflare R2 Data Access S3 API Presigned URLs documentation https://developers.cloudflare.com/r2/data-access/s3-api/presigned-urls Specifically, I am looking for guidance on how to enforce the content length and content type restrictions when generating the signed URL. I am getting a presigned url using the following function, but it appears I can just upload any file type of any size (which is not the behavior I'm looking for).
    Copy code
    export const generateURL = async (fileType: string, fileSize: number, config: Config) => {
      const allowed_file_size = 5
      if (Number(fileSize) / (1024 * 1024) > allowed_file_size) {
        throw Error('File too large')
      }
    
      const allowed_file_types = ['image/png', 'image/jpg', 'image/jpeg']
      if (!allowed_file_types.includes(fileType)) {
        throw Error(`File type not allowed. Allowed types are: ${allowed_file_types.join(', ')}.`)
      }
    
      const r2 = new AwsClient({
        accessKeyId: config.r2.accessKey,
        secretAccessKey: config.r2.secretKey
      })
    
      const fileName = `${nanoid(6)}.${fileType.split('/')[1]}`
    
      const url =
        `https://${config.r2.bucketName}.${config.r2.accountId}.r2.cloudflarestorage.com` +
        '/profile' +
        `/${fileName}` +
        '?X-Amz-Expires=3600'
    
      const signed = await r2.sign(url, {
        aws: { signQuery: true },
        headers: {
          'Content-Type': fileType,
          'Content-Length': `${fileSize}`
        },
        method: 'PUT'
      })
    
      return { fileName, url: signed.url }
    }
  • s

    Sid | R2

    03/15/2023, 11:58 AM
    Hmm unless I'm misunderstanding thissue, I cannot repro this. I've got a custom domain attached to a public bucket with r2.dev disallowed, and yet I can access my bucket publicly. Are you accidentally visiting the r2.dev URL?
  • t

    theompm

    03/15/2023, 12:02 PM
    Connecting customer domain example.com to bucket. -> visit example.com -> not allowed to see bucket
  • s

    Skye

    03/15/2023, 12:03 PM
    Are you expecting
    /
    to serve
    /index.html
    ?
  • t

    theompm

    03/15/2023, 12:04 PM
    I was expecting a folder tree
  • s

    Skye

    03/15/2023, 12:04 PM
    R2 doesn't do that at the moment
  • s

    Skye

    03/15/2023, 12:04 PM
    If the asset you try to get doesn't exist, you'll see that page
  • t

    theompm

    03/15/2023, 12:06 PM
    Thank you for helping
  • x

    xokaido

    03/15/2023, 12:13 PM
    Hello, I've just setup R2 service with custom domain, it is working perfectly fine, I just want to replace cloudflare's index page with my own. I am getting 404 error when I try to access domain.
  • m

    morpig

    03/15/2023, 12:31 PM
    i don't think that's possible yet. just create a worker for that. if get object not found, return 404 w/ html
  • m

    morpig

    03/15/2023, 12:32 PM
    r2 team, I'm noticing the following
    Copy code
    get: Client Disconnect (10054)
    on my workers log, is it related with R2? i have r2 get + put ops, but idk what that error message relates to.
  • n

    nikitasius

    03/15/2023, 2:58 PM
    hi folks, i have a question: if there are way to manage object expiration for R2? I checked the docs but did not found it. Like AWS S3 have management (with different object transformations), but only "delete in 2 days" or "delete in 3 days"?
  • s

    Skye

    03/15/2023, 2:59 PM
    It's not currently supported unfortunately
  • n

    nikitasius

    03/15/2023, 3:01 PM
    well at least it could be done in theory via cron which will list object and simply wipe them. But "from the box" could be good. personally: i like CF and use it almost 10 years šŸ™‚ it's nice to see how CF is developping
1...942943944...1050Latest