• View Communities
    • Citrix Developer Network
      The place for unfiltered straight talk on Citrix products. Blogs, code downloads, best practices, APIs, and more can all be found here.
    • Citrix Ready Community Verified
      Does it work with Citrix? Application compatibility questions are a thing of the past with the new Citrix Community Verified site.
    • Blogs
      Learn the latest from the Citrix employees who are building application delivery infrastructure technologies.
    • Blogosphere
      The Citrix Blogosphere is a window into the thousands of conversations taking place about Citrix and Application Delivery.
  •  Sign In
NetScaler Developer Network

Rewriting Chunked Responses

The Netscaler Rewrite Module is able to rewrite server responses based on set policies. However, if the responses are chunked, the rewrite function will not work as the Netscaler does not buffer the entire response. Therefore, we need to make sure the server does not send chunked responses.

Summary


In this example, the application was J.D. Edwards and it was discovered that the Netscaler was unable to rewrite chunked responses from the server. This caused issues as the customer was attempting to rewrite outbound body content (using delete_all) but the Netscaler was unable to do so with chunked responses. The first solution was to disable HTTP 1.1 on the web server. While this worked, this solution was not supported by Oracle and as such was not viable. Therefore, we needed a way to disabled chunked responses without modifying the web server. <br>

The solution was to rewrite the inbound browser HTTP version to 1.0 which forces the web server to respond with the full response, not chunked responses.

CLI Command:

 Add rewrite action to replace HTTP Minor with 0:
add rewrite action ReplaceHTTP1.1with1.0 replace http.REQ.VERSION.MINOR "\"0\""

Add rewrite action to delete the HTTP header TE (just a precautionary measure):
add rewrite action DeleteTEHeader delete_http_header TE

Add policy to check for HTTP version. If it's 1.1, replace with 1.0:
add rewrite policy ReplaceHTTP1.1with1.0 "HTTP.REQ.VERSION.CONTAINS(\"1.1\")" ReplaceHTTP1.1with1.0

Add policy to check if the HTTP header TE is present:
add rewrite policy DeleteTEHeader "HTTP.REQ.HEADER(\"TE\").EXISTS" DeleteTEHeader

Bind the policies (note the gotoPriorityExpression to ensure both policies are evaluated):
bind lb vserver HTTPVIP -policyName ReplaceHTTP1.1with1.0 -priority 1 -gotoPriorityExpression END -type REQUEST
bind lb vserver HTTPVIP -policyName DeleteTEHeader -priority 2 -gotoPriorityExpression NEXT -type REQUEST

At this point, the server should not respond with chunked responses and you should be able create rewrite policies/actions to rewrite response side content.

*It is important to note that the Netscaler may still respond to the client with a chunked response although the server responded with non-chunked. This is okay as the rewrite occurs before the Netscaler sends out the chunked response*

 

More Information

Tags

rewrite rewrite Delete
appexpert appexpert Delete
code code Delete
priority priority Delete
goto goto Delete
pattern pattern Delete
chunked response chunked response Delete
rewrite chunked rewrite chunked Delete
content rewrite content rewrite Delete
header rewrite header rewrite Delete
rewrite chunked responses rewrite chunked responses Delete
disable chunked disable chunked Delete
delete header delete header Delete
replace header replace header Delete
how to how to Delete
Enter tags to add to this page:
Please wait 
Looking for a tag? Just start typing.
Related Links