Static asset file limits
Hi there! I opened a thread in #pages-help earlier this year about file count limits: https://discord.com/channels/595317990191398933/1361914707430080513
We're moving away from Pages to a Worker, and workers docs state the existing rate limits (20k files max) are still in place for Static Assets.
I'm just checking in to see if that is still a hard limit, or if the limit can be increased on request?
Thanks!
2 Replies
It’s a hard limit for both
Good to know, ty! Will poke around with R2 and see what we can come up with! Time to learn some stuff about caching and bindings, probably 😄
For anyone who stumbles onto this in future, I ended up using KV, mostly for tooling reasons (we're moving a looot of files, and RClone doesn't work locally -- I want our dev env to be super close to prod, and the KV tooling feels more mature here?), but you can use pretty much whatever alternative Cloudflare storage you need.
1. I split our 11ty build into
_site/assets
and _site/content
2. I bound _site_assets
to the worker assets for feeds, favicon, CSS, JS, etc
3. I wrote a script that pushes each HTML file in _site/content
into a KV store with { key: {file path here}, value: {html here} }
and wrote my own simple manifest file on our end so we only upload to the KV when the HTML actually changes
4. I wrote a single worker which uses hono
, handles the various routes and has a handler for the specific routes that will grab the value from the KV store and return it as a HTML response
Still testing, but it's crazy fast. Pretty happy with how it's coming along. If KV turns out to not be suitable for whatever reason, it's just a new import script and minor changes to the handler to switch to a different type of storage.