KEMBAR78
Fixes routing issue with path filters and static uri by spencergibb · Pull Request #3747 · spring-cloud/spring-cloud-gateway · GitHub
Skip to content

Conversation

@spencergibb
Copy link
Member

The problem arises from when MvcUtils.setRequestUrl is called depending on if the route was created via config, using http(uri) or having it set in a before filter.

To fix this, the uri is now always set in a before filter and the http(uri) methods are deprecated in favor of a BeforeFilterFunctions.uri() method.

A new DefaultHandlerSupplier was created to use an updated HandlerDiscoverer.Result that has fields for lowerPrecedenceFilters and higherPrecedenceFilters as the http() family of Handler methods need associated filters.

This results in a more consistent handling of the request url attribute.

Existing methods and constructors are deprecated.

TODO: update the docs to use the new uri filter.

Fixes gh-3736

The problem arises from when MvcUtils.setRequestUrl is called depending on if the route was created via config, using `http(uri)` or having it set in a before filter.

To fix this, the uri is now always set in a before filter and the `http(uri)` methods are deprecated in favor of a BeforeFilterFunctions.uri() method.

A new DefaultHandlerSupplier was created to use an updated HandlerDiscoverer.Result that has fields for lowerPrecedenceFilters and higherPrecedenceFilters as the `http()` family of Handler methods need associated filters.

This results in a more consistent handling of the request url attribute.

Existing methods and constructors are deprecated.

TODO: update the docs to use the new `uri` filter.

Fixes spring-cloudgh-3736
@spencergibb spencergibb requested a review from ryanjbaxter March 26, 2025 15:19
@spencergibb spencergibb self-assigned this Mar 26, 2025
@spencergibb spencergibb linked an issue Mar 26, 2025 that may be closed by this pull request
@spencergibb spencergibb marked this pull request as ready for review March 28, 2025 14:41
@spencergibb spencergibb merged commit 55b3cd0 into spring-cloud:4.1.x Mar 28, 2025
2 checks passed
@spencergibb spencergibb deleted the path-filters-gh3736 branch March 28, 2025 18:59
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.

Routing broken in 4.2.1 with stripPrefix filter and others

2 participants