how to deliver static assets from another R2 bucket directly like open next?
Hi, I’m integrating the H5P standalone library (https://github.com/tunapanda/h5p-standalone) with our Next.js app. We need to deliver H5P content type libraries and content files. The libraries can be in a shared directory, and the content follows the H5P folder structure. Since Cloudflare is now integrating R2 for static assets with the OpenNext project, how can we deliver these assets from another bucket while maintaining the required folder structure?
GitHub
GitHub - tunapanda/h5p-standalone: Display H5P content without the ...
Display H5P content without the need for an H5P server - tunapanda/h5p-standalone
4 Replies
You'll want your Worker to have an R2 binding with your intended bucket and then fetch
Not sure what needs to happen to the path but some simple code:
Do you think it would cost on workers side?
Assets in the public directory are delivered using the assets binding in new Open Next.js projects.
Here’s the link for reference: https://opennext.js.org/cloudflare/get-started.
The issue is that I have to store all my assets in Git, and during deployment, they are automatically delivered via the assets binding.
What I want is to achieve the same functionality but with my own R2 bucket. Does that make sense?
Cloudflare Docs
Configuration and binding | Cloudflare Workers docs
Details on how to configure Workers static assets and its binding.
any help?
@Cloudflare (Server Owner)