You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm using spring gateway mvc as a simple gateway to route input request to backend app. My route config rewrite the host and the url base path.
It works well except for multipart requests. With a multipart request, the output body is empty.
After some research in my side to identify the problem, it seems the rewritePath function is the root cause. If I delete it of my route, multipart requests works.
I'm using the function rewritePath in org.springframework.cloud.gatexay.server.mvc.BeforeFilterFunctions in a RouterFunction policy.
Sample
To prove the problem, I reproduced the case with this simple code.
@Configuration
public class RouterConfiguration {
private static final String WILDCARD = "/**";
private static final String SEGMENT_TO_INCLUDE_REGEX = "(?<segment>.*)";
private static final String SEGMENT_TO_ADD_REGEX = "${segment}";
@Bean
public RouterFunctions.Builder routerFunctionsBuilder() {
return RouterFunctions.route();
}
@Bean
public RouterFunction<ServerResponse> buildRoutes(RouterFunctions.Builder routerFunctionsBuilder) {
var destinationHost = URI.create("http://localhost:9008/");
routerFunctionsBuilder
.POST("multipart" + WILDCARD, HandlerFunctions.http(destinationHost)) // multipart works with this line only
// multipart don't work anymore in adding the filter (body is empty)
.before(BeforeFilterFunctions.rewritePath("multipart" + SEGMENT_TO_INCLUDE_REGEX, "/api/multipart" + SEGMENT_TO_ADD_REGEX));
return routerFunctionsBuilder.build();
}
}
Versions
Spring Boot : 3.3.0
spring cloud starter gateway mvc : 4.1.5
Describe the bug
I'm using spring gateway mvc as a simple gateway to route input request to backend app. My route config rewrite the host and the url base path.
It works well except for multipart requests. With a multipart request, the output body is empty.
After some research in my side to identify the problem, it seems the rewritePath function is the root cause. If I delete it of my route, multipart requests works.
I'm using the function rewritePath in org.springframework.cloud.gatexay.server.mvc.BeforeFilterFunctions in a RouterFunction policy.
Sample
To prove the problem, I reproduced the case with this simple code.
Versions
Spring Boot : 3.3.0
spring cloud starter gateway mvc : 4.1.5
related issues but not solved : 3449
** Expectations **
rewritePath function works with multipart requests
The text was updated successfully, but these errors were encountered: