EncoderHttpMessageWriter sets Content-Length even if Transfer-Encoding header is present #32572
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: invalid
An issue that we don't feel is valid
dependency: org.springframework:spring-web:5.3.29
Class: EncoderHttpMessageWriter
Hy,
I need to forward a request as-is to another server, so basically my server only acts as a proxy. I use the org.springframework.web.reactive.function.client.WebClient and in the REST endpoint I have this code
proxyExchange.uri(requestUri).forward().awaitFirst()
The response that comes back here might contain the header "Transfer-Encoding" - which is perfectly fine. The problem is that the EncoderHttpMessageWriter always sets the header "Content-Length" regardless the response headers that are already present. This seems to be unavoidable if Mono is used.
These two headers then cause the client to deny the response from my proxy server, because they must not be returned at the same time.
The text was updated successfully, but these errors were encountered: