kotx/render
关于
用于代理并缓存发往 R2 的请求的 Cloudflare Worker。
系统与基础设施可以做什么
- File listings (with optional hidden files)!
- Handles HEAD, GET, and OPTIONS requests
- Forwards caching headers (etag, cache-control, expires, last-modified)
- Forwards content headers (content-type, content-encoding, content-language, content-disposition)
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Render
Proxies readonly requests to Cloudflare R2 via Cloudflare Workers.
If you want an uploader, try Aster!
If you see a bug or something missing, please open an issue or pull request!
Features
- File listings (with optional hidden files)!

- Handles
HEAD,GET, andOPTIONSrequests - Forwards caching headers (
etag,cache-control,expires,last-modified) - Forwards content headers (
content-type,content-encoding,content-language,content-disposition) - Caches served files using the Cache API
- Ranged requests (
range,if-range, returnscontent-range) - Handles precondition headers (
if-modified-since,if-unmodified-since,if-match,if-none-match) - Can serve an appended path if the requested url ends with / - Defaults to
index.htmlin 0.5.0 - Can serve custom 404 responses if a file is not found
Setup
Configuration
Create your R2 bucket(s) if you haven't already (replace bucket_name and preview_bucket_name appropriately):
pnpm install
pnpm wrangler r2 bucket create bucket_name # required
pnpm wrangler r2 bucket create preview_bucket_name # optional
You can also do this from the Cloudflare dashboard.
Edit wrangler.toml to have the correct bucket_name and optionally, preview_bucket_name (you can set it to bucket_name) if you're going to run this locally.
You can do this from a fork, if using the GitHub Actions method.
You may edit CACHE_CONTROL to the default cache-control header or remove it entirely to fall back to nothing. If you set CACHE_CONTROL to "no-store" then Cloudflare caching will not be used.
Deploying
Note: Due to how custom domains for workers work, you MUST use a route to take advantage of caching. Cloudflare may fix this soon. Also note that *.workers.dev domains do not cache responses. You MUST use a route to your own (sub)domain.
If you want to deploy render with multiple domains for one worker, check out multi-render! It uses render as a package to serve multiple buckets to multiple domains with custom configurations.
Method 1 (Local)
pnpm wrangler publish # or `pnpm run deploy`
Method 2 (GitHub Actions)
- Fork this repository
- Set the secrets
CF_API_TOKEN(with theEdit Cloudflare Workerstemplate) andCF_ACCOUNT_IDin the repo settings - Enable workflows in the Actions tab
- Update
wrangler.tomlas needed (this will trigger the workflow) - (Optionally) set the worker route in the Cloudflare dashboard to use the Cache API
Using as a package
You may use this worker's functionality as a package by installing and importing render2:
npm install render2
Usage:
import render from "render2";
render.fetch(req, env, ctx);
You can see an awesome example with Erisa's multi-render!
Development
Install deps:
pnpm install
To launch the development server:
pnpm run dev
Notable Related Projects
- auravoid's fork adds Plausible support.
- Erisa's project multi-render add support for domain-specific configurations.
探索相关项目
加载中…