This document contains information about preventing the backend server from sending chunked responses.
If you need to rewrite response body, then you should ensure that the response is not served by the backend server in a chunked format.
Some of the NetScaler appliance features, such as HTML Injection and body rewrite, do not work as expected when the backend server sends chunked response. You can create a policy similar to the following policy that prevents the backend server from sending chunked response:
add rewrite action no_chunk replace http.req.version "\"HTTP/1.0\""
add rewrite policy no_chunk_pol true no_chunk
bind rewrite global no_chunk_pol 10 NEXT -type REQ_DEFAULT
In the preceding policy, the HTTP version is changed to HTTP/1.0, which, according to the RFC, disables chunking of the response as a global policy.
Chunked response is a method that a Web server uses when the content being generated is dynamic and the server does not know how much data is being sent before the server starts to transmit the data. The server sends a response header stating that the content is chunked. Additionally, in the first bytes of the body, the server states that the size of the first chunk of data being sent. Each chunk of data is followed by a new header that states the size of data that is following, until a chunk size of 0 is specified. This indicates the Web browser that no more data is expected.