spring-cloud-gateway
spring-cloud-gateway copied to clipboard
The file uploaded by the client in the mode of transfer encoding: chunked cannot be forwarded correctly by the gateway.
Describe the bug Use version:spring-cloud-gateway-core:2.1.2.RELEASE
Upload the file as transfer encoding: chunked. When passing through the gateway, the gateway filters out the transfer encoding, but does not specify content length or transfer encoding, resulting in the downstream receiving no data
Sample NettyRoutingFilter.class
//=========The transfer encoding request header is filtered out here
HttpHeaders filtered = filterRequest(getHeadersFilters(), exchange);
.......
Flux<HttpClientResponse> responseFlux = this.httpClient
.chunkedTransfer(chunkedTransfer).request(method).uri(url)
.send((req, nettyOutbound) -> {
//=========The file uploaded by the client adopts transfer encoding: chunked
//=======Here, the transfer encoding request header is filtered out, but the content length is not specified, so the downstream //=======cannot obtain the content length / transfer encoding, so the file stream cannot be obtained. Personally, I suggest that if //=======the client is transfer encoding: chunked, the request header should also be specified here as transfer encoding: chunked
req.headers(httpHeaders);
......
}
Gateway 2.x is not longer supported. Is this still an issue in 3.1.x? If so, if you'd like us to spend some time investigating, please take the time to provide a complete, minimal, verifiable sample (something that we can unzip attached to this issue or git clone, build, and deploy) that reproduces the problem.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.



problem is still exist
In RemoveHopByHopHeadersFilter
you can actually set the list of headers removed using spring.cloud.gateway.filter.remove-hop-by-hop.headers
. So my first question is if they modify this property to not remove transfer-encoding if it would work?
Having a sample that reproduced the issue would be helpful in us assisting you.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.