测试新的限速服务 – 欢迎反馈
2 分•作者: 0megion•8 个月前
大家好,
我正在构建一个名为 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 执行您的限制,然后转发到您的源站。最简单的即插即用方式。
```
客户端 ---> 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 .