Rewrite Policy - Downgrading to HTTP 1.0

Added by Catherine Hampton , last edited by Catherine Hampton on Mar 05, 2008  (view change)
Tags: 

This article describes how to use a Rewrite rule to force a web server to send responses as HTML 1.0 rather than HTML 1.1. This disables response chunking and allows Rewrite rules to be used on the response HTML.

Summary

In the NetScaler 8.0 and 8.1 releases, the Rewrite feature cannot perform rewrites on the HTML body portion of chunked HTTP 1.1 responses. To use body Rewrite on HTTP responses, the responses must not be chunked. There are three ways that users can work around this limitation:

  • Disable chunked responses on the web server.
  • Downgrade web server responses to HTTP 1.0 on the web server.
  • Use a Rewrite rule on requests to modify the HTTP request version from 1.1 to 1.0.

For web sites most of whose pages require body rewriting, the first or second options should provide better performance. For web sites with only a few pages that require body rewriting, however, the third option may be preferable because you can write a policy or policies that apply it only to the necessary web pages.

The procedure below describes how to use a Rewrite rule to modify the HTTP request version.

First, you add the Rewrite action, named act_downgrade_1.0, as shown below:
      > add rewrite action act_downgrade_1.0 replace http.req.version "\"HTTP/1.0\""

Next, you add the Rewrite policy. A simple Rewrite policy that matches all requests, named pol_downgrade_1.0, is shown below:
      > add rewrite policy pol_downgrade_1.0 true act_downgrade_1.0

You can also use Rewrite policies that target only requests for pages on specific web hosts, for pages in specific directories on the web server, or even for specific pages. For example, if you want to rewrite the URLs on all pages returned by the host search.example.com, you could create the following Rewrite policy, named pol_search_downgrade_1.0:
      > add rewrite policy pol_query_downgrade_1.0 "HTTP.REQ.HOSTNAME.SERVER.EQ("search.example.com")" act_downgrade_1.0

Finally, you globally bind the Rewrite policy to put it into effect. The following command binds the simple Rewrite policy, named pol_downgrade_1.0, globally:
      > bind rewrite global pol_downgrade_1.0 1 -type RES_DEFAULT

If you named your Rewrite policy differently, you simply substitute the name of your Rewrite policy for pol_downgrade_1.0.

More Information