I’m new to cloudflare and I’m using backblaze b2 for my app’s resource management.
Since most of my app’s users aren’t from US so I’m trying to use cloudflare worker as a cdn.
I followed the official document and it seems like everything went pretty well.
But when I try to call api using worker-name.username.workers.dev/b2_some_api, it returns 404.
Has anyone had the same issue?
Hi, @di1! The Cloudflare Worker in that article is designed to proxy GET and HEAD requests to Backblaze B2’s S3-compatible API, and it looks like that’s working for you.
B2 API calls won’t work at all with this Worker, as it uses the S3-compatible API endpoint. It would be straightforward to extend the code, or create another Worker, to proxy B2 Native API requests via Cloudflare, but I’m curious - why would you want to do that rather than calling the B2 API directly?
Hi @metadaddy ,
thanks for the explanation. I have implemented the code in my app calling B2 api directly and it’s working fine. But the thing is most of my users are in Asia and it’s just too slow to use the B2 api and download the files directly.
Anyways, the document says it’s an integration for cloudflare worker with Backblaze B2. But what you’re saying is that it’s actually for S3 compatible apis only? I guess I should change the codes to call S3 apis instead of B2 native apis.
I guess I should change the codes to call S3 apis instead of B2 native apis.
Which APIs do your users call? Downloads should go via Cloudflare to get the benefit of caching at the edge. Uploads should still go direct to B2. Cloudflare doesn’t provide any performance improvement for uploading files to B2.