api7 / api7/aisix

窗口级限流触发 429 时,Retry-After 头问题

Open
#1,157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
157
Forks
32
Avg merge
1h 25m
Merged PRs (30d)
145

Description

窗口级限流(rpd/tpd 等)触发 429 时,Retry-After 头的值是「到窗口边界的剩余秒数」,无上限钳制。rpd 在 UTC 天初触发时该值可达 86000+(接近一整天)。严格遵循该头的客户端(如实测 Goose会按头静默休眠)会长时间无响应,表现为“卡死”。
现状:

  • 头在 apply_retry_headers(crates/aisix-proxy/src/error.rs:775)原样写出,RateLimitError::retry_after_secs() 恒返回 Some,无开关
  • config.yaml ratelimit 段(deny_unknown_fields)、限流策略 schema 均无相关字段
    期望:
    提供配置项对限流 429 的 Retry-After 做钳制:min(窗口剩余秒数, 配置上限),0 表示整个省略该头(客户端按自身退避策略快速失败)。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apply_retry_headers in crates/aisix-proxy/src/error.rs:775 and trace how RateLimitError::retry_after_secs() supplies the Retry-After value. Then inspect the ratelimit section of config.yaml and the rate-limit policy schema; done means a configurable cap is supported for 429 responses, with 0 omitting the header.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.