Appendix C Tutorial Examples of Advanced Policies for Rewrite 249
add rewrite policy "pol_remove-ae" true "act_remove-ae"
add rewrite policy "pol_remove-cl" true "act_remove-cl"
To bind the policy globally by using the NetScaler command line
At the NetScaler command prompt, type one of the following commands, as
appropriate, to globally bind the policy that you have created:
bind rewrite global pol_remove_ae 100
bind rewrite global pol_remove_cl 200
Reducing Web Server Redirects
This example explains how to use a Rewrite policy to modify connections to your
home page and other URLs that end with a forward slash (/) to the default index
page for your server, preventing redirects and reducing load on your server.
To modify directory-level HTTP requests to include the default home page
by using the command line
1. To create a Rewrite action named action-default-homepage that
modifies URLs that end in a forward slash to include the default home page
index.html, type:
add rewrite action "action-default-homepage" replace
q#http.req.url.path "/" "/index.html"#
2. To create a Rewrite policy named policy-default-homepage that
detects connections to your home page and applies your new action, type:
add rewrite policy "policy-default-homepage"
q#http.req.url.path.EQ("/") "action-default-homepage"#
3. Globally bind your new policy to put it into effect.
Masking the Server Header
This example explains how to use a Rewrite policy to mask the information in the
Server header in HTTP responses from your Web server. That header contains
information that hackers can use to compromise your Web site. While masking
the header will not prevent a skilled hacker from finding out information about
your server, it will make hacking your Web server more difficult and encourage
hackers to choose less well protected targets.
To mask the Server header in responses from the command line
1. To create a Rewrite action named act_mask-server that replaces the
contents of the Server header with an uninformative string, type: