1 Answer
- Newest
- Most votes
- Most comments
0
AWS ALB supports HTTP/2 for clients, but by default it communicates with the target group using HTTP/1.1. HTTP/2 does not require a Content-Length: 0 header for empty bodies, but HTTP/1.1 does require it.
Therefore, can you try explicitly set the Content Length to 0 when it is 0. Alternatively, set the protocol version of the ALB to allow HTTP/2.
Relevant content
- AWS OFFICIALUpdated 10 months ago

The problem is we are not building the API, but using a Java Client and some APIs exposed by it. The Java Client is using okhttp as the client. The Java API's behavior is to add Transfer-Encoding:chunked to the header even though the request body is zero-length. The problem is happening only on APIs with *Transfer-Encoding:chunked + zero-length body. * Below are working fine
The problem got resolved when ALB was updated to HTTP1.1 (ie. HTTP1.1 communication end-to-end). Alternatively, set the protocol version of the ALB to allow HTTP/2. --> Not sure whether I get it. If the suggestion is to set HTTP/2 from ALB to backend, my backend is not ready for HTTP/2. If the suggestion is to allow HTTP/2 from client to ALB, that was the case when the problem appeared. It got resolved when we made HTTP1.1 from client to ALB.