On this page
步骤
- b2中创建私有桶
- 桶信息加
{"Cache-Control": "public, max-age=604800"}以便缓存 - 创建key用来访问私有桶
- 桶信息加
- 克隆https://github.com/backblaze-b2-samples/cloudflare-b2
- 变为自己的私有仓库,以防配置的key泄露
- 使用wrangler.jsonc配置文件
- 替换桶名,key等
- 新建cloudflare worker
- 选择这个仓库部署
通过cloudflare worker 访问,如果响应头返回cf-cache-status: HIT表示命中缓存
trouble shooting
[ERROR] Missing entry-point to Worker script or to assets directory
加wrangler.jsonc配置文件
- wrangler.jsonc:新版推荐,支持注释,配置更灵活。
- wrangler.toml:旧版遗留格式,逐步淘汰。