You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the Jdk HttpClient, when no body is present in a GET or HEAD request, and that the downstream server only supports HTTP 1.1:
a Transfer-Encoding: chunked will be added to the downstream request, causing some WAF to reject it (see "Body in GET or HEAD requests" in BIG-IP ASM HTTP protocol compliance for example).
The reason seems to be a combination of the issue describe in GH-3308 that causes HTTP 1.1 exchange to be always performed in chunked mode, and the fact that the body is always set in RestClientProxyExchange.
This will cause this JdkClientHttpRequest check to think that there is a body (since body is not null and upstream Content-Length: 0 was removed if present) and will cause the addition of the Transfer-Encoding: chunked header later.
isBodyPresent(request) is simply checking that request.getServerRequest().servletRequest().getInputStream().available() > 0 (using upstream Content-Length or Transfer-Encoding would not work if server.http2.enabled=true).
I can submit a PR if you feel that the fix is relevant.
The text was updated successfully, but these errors were encountered:
Using the
Jdk HttpClient
, when no body is present in aGET
orHEAD
request, and that the downstream server only supportsHTTP 1.1
:a
Transfer-Encoding: chunked
will be added to the downstream request, causing some WAF to reject it (see "Body in GET or HEAD requests" in BIG-IP ASM HTTP protocol compliance for example).The reason seems to be a combination of the issue describe in GH-3308 that causes
HTTP 1.1
exchange to be always performed inchunked
mode, and the fact that the body is always set in RestClientProxyExchange.This will cause this JdkClientHttpRequest check to think that there is a body (since body is not null and upstream
Content-Length: 0
was removed if present) and will cause the addition of theTransfer-Encoding: chunked
header later.As a workaround I've implemented this fix
isBodyPresent(request)
is simply checking thatrequest.getServerRequest().servletRequest().getInputStream().available() > 0
(using upstreamContent-Length
orTransfer-Encoding
would not work ifserver.http2.enabled=true
).I can submit a PR if you feel that the fix is relevant.
The text was updated successfully, but these errors were encountered: