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

    WeeJeWel

    04/29/2023, 2:43 PM
    When will R2 Public Access work with gzip + http range? Currently, when specifying a
    Range
    header, e.g.
    bytes=0-10240000
    , the response is never gzipped, regardless specifying
    gzip, deflate, br
    . I've solved this using a worker now, but that's more expensive.
  • w

    WeeJeWel

    04/29/2023, 2:47 PM
    For reference, AWS CloudFront supports it.
  • o

    oldmanmeta

    04/29/2023, 4:21 PM
    Hi - I've noticed that I'm getting cached results when viewing an updated file in a bucket. I've tried every combination of Cache-Control header in my fetch call, but it's constant. A shift refresh appears to then pull the updated record back. I was looking at the response headers and I don't see anything there around cache either. Is there a setting in the bucket that I'm just not seeing, or any advice on how to ensure a latest data returned from a JS/TS fetch call?
  • k

    kian

    04/29/2023, 4:28 PM
    Public domains follow normal CF cache rules - so your request's Cache-Control header doesn't really do anything
  • k

    kian

    04/29/2023, 4:28 PM
    If you want to disable caching on a domain, use a Cache Rule
  • o

    oldmanmeta

    04/29/2023, 4:31 PM
    @kian thanks for the response. I guess the challenge here is that I have a private application to set values in a json file - I want to see the immediate change in that file after it has overwritten the existing one there. I don't want to disable the cache, because the client applications that read that file should in deed get a cached response for the most part.
  • o

    oldmanmeta

    04/29/2023, 4:33 PM
    It's also for one specific bucket at the moment, not the entire domain - not sure if that makes a difference, but reading the docs with respect to the cache mechanic, I was thinking that Purging the caching was a direction worth exploring, but it's not exactly easy reading to understand what is the right way to go
  • k

    kian

    04/29/2023, 4:33 PM
    Use the S3 API to read that file w/o using the custom domain?
  • k

    kian

    04/29/2023, 4:33 PM
    Not sure if Cache Rules allow you to bypass cache based on a query param - you could also try that
  • o

    oldmanmeta

    04/29/2023, 4:34 PM
    Thanks - some great ideas there for sure. S3 API might be the way to go. I'll do a test. Cheers
  • o

    oldmanmeta

    04/29/2023, 4:42 PM
    @kian - my bad. I just noticed a single non async fetch call in my code. So I was writing the update and running a query on the bucket before the update had completed. Thanks for you quick response, really appreciate it. Cheers
  • a

    Ambyjkl

    04/29/2023, 6:41 PM
    sorry i meant the s3 url
  • a

    Ambyjkl

    04/29/2023, 6:42 PM
    actually neither the Public R2.dev Bucket URL nor the S3 API url are advertising h2 in the alpn, only http/1.1
  • k

    Karew

    04/29/2023, 6:45 PM
    r2.dev doesn’t matter much. You can’t put it into production because it has very row rate limits.
  • k

    Karew

    04/29/2023, 6:46 PM
    I don’t know exactly why the S3 API would not have http/2 but I also don’t think you’ll derive much benefit from it there
  • k

    knpwrs

    04/29/2023, 7:11 PM
    That did the trick, thank you!
  • d

    DJPaul

    04/29/2023, 10:43 PM
    If I set the Custom Domain for R2 to be a subdomain of a domain on Cloudflare, is creating a Page Rule for the subdomain, to set Cache = Cache Everything, the best way to achieve that?
  • k

    Karew

    04/29/2023, 10:44 PM
    Use a new Cache Rule, but yes
  • k

    Karew

    04/29/2023, 10:45 PM
    Page Rules are on an undefined chopping block for the future
  • d

    DJPaul

    04/29/2023, 10:49 PM
    thanks
  • t

    ThatsNoMoon

    04/29/2023, 10:53 PM
    I tried to set this CORS policy on my R2 bucket at `storage.thatsnomoon.dev`:
    Copy code
    json
    [
      {
        "AllowedOrigins": [
          "http://127.0.0.1:1111",
          "https://thatsnomoon.dev"
        ],
        "AllowedMethods": [
          "GET"
        ]
      }
    ]
    but requesting one of the objects in the bucket, like
    https://storage.thatsnomoon.dev/charter_regular.woff2
    , still doesn't send a
    Access-Control-Allow-Origin
    header, whether I do it in the browser or
    curl
    with or without an
    Origin
    header. what am I missing?
  • k

    Karew

    04/29/2023, 11:00 PM
    I am getting a CORS response, maybe clear your Cloudflare caches?
  • k

    Karew

    04/29/2023, 11:00 PM

    https://s.karew.wtf/377CGNiD4l.png▾

  • t

    ThatsNoMoon

    04/29/2023, 11:04 PM
    ahh, that looks better. thanks!
  • j

    JHNP727

    04/30/2023, 10:03 AM
    If you expect globally distributed users, what would be the recommendation for bucket location? Should you create different buckets for each region, and then implement some logic on the worker to decide which one to use? Or is is better to create just one bucket with one location, and Cloudflare optimizes it behind the scenes depending on from where the worker accesses it?
  • c

    chientrm

    04/30/2023, 10:05 AM
    just 1 bucket for 1 location 😐
  • k

    Karew

    04/30/2023, 10:20 AM
    I would place the bucket where you expect the most traffic to come from, or where it will be closest to your other software that might access it. But it really isn’t going to kill you in the long run.
  • i

    Ivan

    04/30/2023, 10:41 AM
    Hi all, am currently trying to perform a multi file upload using cloudflare workers and R2 but I keep getting this error
    Copy code
    EntityTooSmall: Your proposed upload is smaller than the minimum allowed object size.
    I previously tried using the workers R2 Runtime error and got the same error too. Any tips on how to debug this?
    • 1
    • 2
  • e

    edgaras

    04/30/2023, 12:43 PM
    Hey, is there a way to batch download a folder?
  • h

    HardAtWork

    04/30/2023, 12:43 PM
    You can use https://rclone.org to copy a folder to your local device
1...100310041005...1050Latest