Skip to content

Fix path segment API versioning in blocking LoadBalancer - #1759

Open
NotAFlightRisk wants to merge 1 commit into
spring-cloud:5.0.xfrom
NotAFlightRisk:loadbalancer-path-segment-api-version
Open

NotAFlightRisk wants to merge 1 commit into
spring-cloud:5.0.xfrom
NotAFlightRisk:loadbalancer-path-segment-api-version

Conversation

@NotAFlightRisk

Copy link
Copy Markdown

Path segment API versioning doesn't work with a @LoadBalanced RestClient or RestTemplate, it falls over before an instance even gets picked. The servlet PathApiVersionResolver only reads a path that DispatcherServlet has already parsed and stored on the request, and the stand-in request built for those calls doesn't have one, so you get IllegalArgumentException: Expected parsed RequestPath in request attribute "org.springframework.web.util.ServletRequestPathUtils.PATH".

This parses it from the URL with no context path, like the WebClient side does. A parsed path that's already in the attributes still wins - Gateway's MVC load balancer filter passes the incomming request's attributes through, so that one has the real context path in it.

I've not run Gateway itself, just a throwaway test giving the supplier a path parsed with a /ctx context path.

Signed-off-by: Iain <iain1970@protonmail.com>

This branch has not been deployed

No deployments
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.

2 participants