spring-cloud / spring-cloud/spring-cloud-gateway
GlobalFilter documentation should be update WRT Order
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Describe the bug
The documentation WRT GlobalFilter and ordering suggests that GlobalFilter and GatewayFilter order can be controls via the Ordered interface (or @Ordered annotation). However, it appears that regardless of the GlobalFilter order, the GatewayFilters are applied first. This should be clarified in the documentation or (preferably) fixed so that a GlobalFilter with a higher precedence than a GatewayFilter will be applied first.
From: https://docs.spring.io/spring-cloud-gateway/reference/spring-cloud-gateway/global-filters.html
"When a request matches a route, the filtering web handler adds all instances of GlobalFilter and all route-specific instances of GatewayFilter to a filter chain. This combined filter chain is sorted by the org.springframework.core.Ordered interface, which you can set by implementing the getOrder() method."
This comment is what clued me in:
https://github.com/spring-cloud/spring-cloud-gateway/issues/2784#issuecomment-1318424901
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 the Global Filters documentation page and the linked comment in issue 2784, then trace how GlobalFilter and route-specific GatewayFilter ordering is described and implemented. Clarify the documented behavior or align the implementation with Ordered precedence, with the documentation and observed filter order agreeing when the work is done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100