spring-cloud / spring-cloud/spring-cloud-gateway
make GatewayFilter created by GatewayFilterFacotory supports setting different order for each route.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
the rateLimiter GatewayFilter was spawned by RequestRateLimiterGatewayFilterFactory, but I noticed I can't specify the order of it unless I overwrite it and wrap it into a OrderedGatewayFilter, even though overwrite and set order works for a singular route, but if there are multiple routes using this filter and want to set different order, then it won't work.
If I have a application.yml like following:
routes:
- id: commonBiz1
uri: lb://commonBiz1
predicates:
- Path=/commonBiz1/**
filters:
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 1
redis-rate-limiter.burstCapacity: 2
redis-rate-limiter.requestedTokens: 1
# implement this application.yml property to set order for different route
filter-order: -100
Is there a way to let gatewayFilterFactory returns OrderedGatewayFilter with different order by different order setting per route?
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 with RequestRateLimiterGatewayFilterFactory and the GatewayFilter creation path, then trace how route filter arguments are applied. Done means different routes can set filter-order and receive independently ordered filters, including the multiple-route case described in the issue.
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
- 35/100