测试一种新的速率限制服务 – 欢迎反馈
大家好,
我正在开发一个名为 Rately 的项目。它是一个基于 Cloudflare Workers 的限流服务(因此运行在边缘,靠近您的客户)。
这个想法很简单:您不仅可以通过 IP 限制请求,还可以根据您自己的数据设置规则——例如:
- URL 参数(/users/:id/posts → 按用户 ID 限制)
- 查询参数 (?api_key=123 → 按 API 密钥限制)
- 头部信息(X-Org-ID、Authorization 等)
举个例子:
假设您的 API 有一个端点 /user/42/posts。使用 Rately,您可以告诉它:“对每个 userId 应用每分钟 100 次请求的限制”。
因此,用户 42 和用户 99 会自动各自获得一个独立的请求桶。无需自定义 nginx 或中间件。
它有两种工作模式:
- 代理模式 – 您将 API 域名(CNAME)指向 Rately。请求进入后,Rately 会执行您的限制,然后转发到您的源 API。这是最简单的集成方式。
```
客户端 ---> Rately(执行限制) ---> 源 API
```
- 控制平面模式 – 您可以像往常一样运行自己的 API,但您的代码或中间件可以在处理请求之前调用 Rately 的 API 来询问“这个请求被允许吗?”这给您提供了更多灵活性,而无需将所有流量都通过 Rately。
```
客户端 ---> 您的 API ---> Rately /check(允许/拒绝) ---> 您的 API 逻辑
```
我正在寻找一些有 API 的开发者来测试这个服务。我会帮助进行设置。
查看原文
Hey all,<p>I’m building a project called Rately. It’s a rate-limiting service that runs on Cloudflare Workers (so at the edge, close to your clients).<p>The idea is simple: instead of only limiting by IP, you can set rules based on your own data — things like:<p>- URL params (/users/:id/posts → limit per user ID)<p>- Query params (?api_key=123 → limit per API key)<p>- Headers (X-Org-ID, Authorization, etc.)<p>Example:<p>Say your API has an endpoint /user/42/posts. With Rately you can tell it: “apply a limit of 100 requests/min per userId”.<p>So user 42 and user 99 each get their own bucket automatically. No custom nginx or middleware needed.<p>It has two working modes:<p>- Proxy mode – you point your API domain (CNAME) to Rately. Requests come in, Rately enforces your limits, then forwards to your origin. Easiest drop-in.<p>```
Client ---> Rately (enforce limits) ---> Origin API
```<p>- Control plane mode – you keep running your own API as usual, but your code or middleware can call Rately’s API to ask “is this request allowed?” before handling it. Gives you more flexibility without routing all traffic through Rately.<p>```
Client ---> Your API ---> Rately /check (allow/deny) ---> Your API logic
```<p>I’m looking for a few developers with APIs who want to test it out. I’ll help with setup .