I'm having a similar situation here loadbalancing a Java-based application. After applying a stream iRule that's working well, there happens to be an issue with the Content-length value in the Http-Response packet.
When the same HTTP Request is send on backend connection, backend server is responding with the 'Content-Length' field in the header but the same response is send to the end client by the BigIP as chunks:
/forms/lservlet;jsessionid=PmyvXQFhynT7w8sYFNDyvtq1pCGQhnptbRnLc43D2Bf1TlNHp5Ws!1431838774
Request/response on frontend connection:
BigIP is sending response to the end-client using chunks.
GET /forms/frmservlet?config=ref&serveruserparams=NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256&otherparams=P_WST_LAN_IND=1+P_BANKS_APP_URL=http://10.10.1.57:9001/banks&ifsessid=WLS_FORMS.formsapp.130&acceptLanguage=en-US,en;q=0.5&ifcmd=startsession&iflocale=en-US HTTP/1.1
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/4.0 (Windows 10 10.0) Java/1.8.0_77
Host: 10.10.1.57:9001
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Cookie: JSESSIONID=gst7XQGF1yrVxH8JvTlQf2VbxNv7PGyTyXkCCfJMNnVSS9Nhvn1T!1431838774
HTTP/1.1 200 OK
Cache-Control: no-cache,no-store
Date: Thu, 21 Jul 2016 12:52:10 GMT
Content-Type: text/plain
X-ORACLE-DMS-ECID: 0000LODWqKTF^6^5xVP5iW1NZWFi000MFK
X-Powered-By: Servlet/2.5 JSP/2.1
Transfer-Encoding: chunked
5a
/forms/lservlet;jsessionid=PmyvXQFhynT7w8sYFNDyvtq1pCGQhnptbRnLc43D2Bf1TlNHp5Ws!1431838774
0
In working scenario when traffic is sent directly to the pool member (bypassing the load balancer), server responds to the client with un-chunked content.
It appears that the Java application requires Content-Length value to be correct and present in HTTP response received on the client-end.
Here is my question:Is there an iRule to find the correct Content-Length value and insert into the Response Header?
I should add that I also have the Rechunk Response set to RECHUNK on the http profile