How does Api-proxy decide whether to use Transfer-Encoding or not?

Api-proxy uses "Transfer-Encoding" to communicate with backend and in few cases it uses "Content-Length". How does Api-proxy decide whether to use Transfer-Encoding or not?

Solved Solved
0 1 1,250
1 ACCEPTED SOLUTION

The apiproxy gets either of these headers from the client request.

So, if the client is sending the 'content-Length' header then it transmits that to the backend else if the client mentions that the request is chunked then the client passes the header 'Transfer-Encoding: chunked' which is used by the apiproxy as well to communicate to the backend.

If the request payload is being built in the apiproxy itself and its a POST to the backend and you haven't specified any of the headers,' Transfer-Encoding' or 'Content-Length', then by default, the apiproxy will use chunked encoding to send the data to the backend.

View solution in original post

1 REPLY 1

The apiproxy gets either of these headers from the client request.

So, if the client is sending the 'content-Length' header then it transmits that to the backend else if the client mentions that the request is chunked then the client passes the header 'Transfer-Encoding: chunked' which is used by the apiproxy as well to communicate to the backend.

If the request payload is being built in the apiproxy itself and its a POST to the backend and you haven't specified any of the headers,' Transfer-Encoding' or 'Content-Length', then by default, the apiproxy will use chunked encoding to send the data to the backend.