spring-cloud-gateway icon indicating copy to clipboard operation
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.

Open goodshred opened this issue 3 years ago • 5 comments

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);
......
}

goodshred avatar Jan 27 '22 09:01 goodshred

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.

spencergibb avatar Mar 02 '22 19:03 spencergibb

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.

spring-cloud-issues avatar Mar 09 '22 19:03 spring-cloud-issues

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.

spring-cloud-issues avatar Mar 16 '22 19:03 spring-cloud-issues

image image image

problem is still exist

goodshred avatar Apr 26 '22 03:04 goodshred

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.

ryanjbaxter avatar Jan 29 '24 16:01 ryanjbaxter

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.

spring-cloud-issues avatar Mar 20 '24 22:03 spring-cloud-issues

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.

spring-cloud-issues avatar Mar 27 '24 22:03 spring-cloud-issues