Well, the 400 Bad Request error is because the request received by the server was for ":50100/irj/portal/" -- the ":50100" part shouldn't be there.
I can't see how the iRule above could have generated such a request. The intended translation seems to have been verified by your earlier testing: We can see in the log that, as expected, a URI of "/irj/portal/" was derived by the iRule when the client requested "/".
Some clarification about your testing might help shed some light on the situation:
- Was this request submitted against a port 443 virtual?
- Was the iRule applied?
- Was the http profile applied?
- Is the original error still appearing in the LTM log?
If the iRule was in place, comparing client-side and sever-side traces would help us see whether that transformation was performed by the load balancer, or it was munged elsewhere by examining both the request as submitted by the client and as received by the server. It would also be good to see the LTM log corresponding to the traces to see if any unexpected values are logged.
I would still recommend going back to where you started & making one change at a time, testing at each step as detailed above. (Only exection being that you must be sure to add re-chunking when adding the stream profile.)
/deb