Skip to content

gateway MVC - Multi-part + query string not working #3220

@florentm35

Description

@florentm35

Describe the bug

With spring cloud gateway mvc 2023.0.0 when we perform an post request with multi part and query string, the query string was loose.

Exemple with an test server on port 9008 and a gateway on port 9007
if i point on the server directly :
image
image
if i use the gateway :
image
image

Sample
http-interceptor : (it's juste a test server to print the query param)

public class MainStandAlone {

    public static void main(String[] args) throws IOException {

        ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);

        HttpServer server = HttpServer.create(new InetSocketAddress("localhost", 9008), 0);
          server.createContext("/", exchange -> {
            System.out.println(exchange.getRequestURI());

            exchange.getResponseBody().write("OK".getBytes(StandardCharsets.UTF_8));
            exchange.sendResponseHeaders(200, "OK".length());
            exchange.getResponseBody().flush();
            exchange.getResponseBody().close();
        });
        server.setExecutor(threadPoolExecutor);
        server.start();
        System.out.println(" Server started on port 9008");
    }
}

gateway : (spring initializr)

@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}

	@Configuration
	public static class GatewayConfiguration {

		@Bean
		public RouterFunction<ServerResponse> routerFunction() {
			return route()
					.POST("/test", http("http://localhost:9008"))
					.build();
		}
	}
}

EDIT:

Moreover the header Content-Length are delete by the gateway

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions