Java 春云门户:获取;在发送请求正文时,响应前已关闭连接;发布大文件时出错
我有一个运行在SpringCloud网关后面的SpringBoot应用程序 spring启动应用程序控制器:Java 春云门户:获取;在发送请求正文时,响应前已关闭连接;发布大文件时出错,java,spring-boot,spring-cloud-gateway,reactor-netty,Java,Spring Boot,Spring Cloud Gateway,Reactor Netty,我有一个运行在SpringCloud网关后面的SpringBoot应用程序 spring启动应用程序控制器: @PostMapping(value = "hi") public String postHi(@RequestHeader HttpHeaders headers, HttpServletRequest request) { return request.getHeader("Content-Length"); } Spring云网关路由配置: spring: cloud:
@PostMapping(value = "hi")
public String postHi(@RequestHeader HttpHeaders headers, HttpServletRequest request) {
return request.getHeader("Content-Length");
}
Spring云网关路由配置:
spring:
cloud:
gateway:
routes:
- id: hi
uri: http://localhost:8080/hi
predicates:
- Path=/hi/**
因此,当我通过邮递员请求上传小文件(大小:1000KB)时,我没有收到任何错误,但当文件较大(大小:10MO)时,我收到以下错误:
{
"timestamp": "2019-12-10T20:52:33.554+0000",
"path": "/hi",
"status": 500,
"error": "Internal Server Error",
"message": "Connection has been closed BEFORE response, while sending request body",
"requestId": "ad589017"
}
使用此堆栈:
reactor.netty.http.client.PrematureCloseException: Connection has been closed BEFORE response, while sending request body
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP POST "/hi" [ExceptionHandlingWebHandler]
Stack trace:
以下是重现该问题的示例: