Skip to content

[RateLimiter] Use the standard "Retry-After" header in the rate limiter example#22370

Merged
javiereguiluz merged 1 commit into
symfony:6.4from
bendavies:fix-retry-after-header
Jun 3, 2026
Merged

[RateLimiter] Use the standard "Retry-After" header in the rate limiter example#22370
javiereguiluz merged 1 commit into
symfony:6.4from
bendavies:fix-retry-after-header

Conversation

@bendavies
Copy link
Copy Markdown
Contributor

The "Exposing the Rate Limiter Status" example exposed a non-standard
X-RateLimit-Retry-After header. The standard HTTP header for 429 Too Many Requests responses is Retry-After:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429

Since TooManyRequestsHttpException already sets the Retry-After header
from its first constructor argument, the example now throws that exception
instead of building the header by hand. This also matches the earlier
"Using the Rate Limiter Service" example, which throws the same exception.

@carsonbot carsonbot added this to the 6.4 milestone Jun 2, 2026
@carsonbot carsonbot changed the title Use the standard "Retry-After" header in the rate limiter example Use the standard "Retry-After" header in the rate limiter example Jun 2, 2026
Comment thread rate_limiter.rst
The example exposed a non-standard "X-RateLimit-Retry-After" header.
The standard HTTP header for 429 responses is "Retry-After", which is
also set automatically by TooManyRequestsHttpException, so the example
now throws that exception instead of building the header by hand.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429
@bendavies bendavies force-pushed the fix-retry-after-header branch from a93401d to 4722730 Compare June 3, 2026 09:06
@carsonbot carsonbot changed the title Use the standard "Retry-After" header in the rate limiter example [RateLimiter] Use the standard "Retry-After" header in the rate limiter example Jun 3, 2026
@javiereguiluz
Copy link
Copy Markdown
Member

This is a solid improvement! Thanks a lot Ben.

@javiereguiluz javiereguiluz merged commit 7590cf7 into symfony:6.4 Jun 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants