spring-cloud / spring-cloud/spring-cloud-gateway
Rate Limit Response - I'd like to modify the body
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
I'd like to customise the body when Rate Limit filter returns 429.
I can add the headers I want, but body is empty and I have a requirement to customise it.
I've tried other filter combinations, they work ok for other responses but it seems after this response is set to complete none of the filter / modifications are applied
Is there any workaround I could apply? Or any chance custom body is added any time soon to
org.springframework.cloud.gateway.filter.ratelimit.RateLimiter.Response ?
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/RequestRateLimiterGatewayFilterFactory.java around line 129, then inspect org.springframework.cloud.gateway.filter.ratelimit.RateLimiter.Response. Determine how a caller could provide a body for the 429 response and validate that the configured body is returned instead of an empty response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100