spring-cloud / spring-cloud/spring-cloud-gateway

GlobalFilter documentation should be update WRT Order

Open
#3,269 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feedback-provided
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.