ADC

Example 12: Configure rewrite to change the host name and URL in client request on NetScaler appliance

Rewrite feature on a NetScaler appliance is used to convert the URL available in the client request to another URL that the back end server can understand. You can achieve the following benefits by using the rewrite feature:

  • Enhances the security by hiding the actual URL to the resource, which is requested by the client.

  • Prevents the unauthorized user access from gaining access to the network resources.

Consider an example where your current organization is acquired by another organization. It becomes a difficult job for admins to inform about the new web address to every user of the acquired organization. In this scenario, using rewrite feature becomes convenient to change the host name and URL in the client requests for the website of the acquired organization. You can use rewrite to change the URLs in the client request temporarily when the website is under maintenance.

The following section describes the procedure to change the host name and URL in a client request using rewrite feature.

Consider an example where the user enters a http://www.example.com URL in the web browser. The website administrator wants the NetScaler appliance to convert the preceding URL in the client request as http://myexample.example.net.in/resource/inventory/s?t=112.

In the preceding example, the website administrator wants the NetScaler appliance to replace the “example.com” domain name with “myexample.example.net.in” and the URL with “resource/inventory/s?t=112”.

Perform the following by using the CLI

  1. Log on to the NetScaler appliance using SSH.

  2. Add rewrite actions.

    • add rewrite action rewrite_domain_url_replace_act replace HTTP.REQ.URL "\"http://myexample.example.net.in/resource/inventory/s?t=112\""
  3. Add rewrite policies for the rewrite actions.

    • add rewrite policy rewrite_domain_url_pol HTTP.REQ.HOSTNAME.EQ("www.example.com") rewrite_domain_url_replace_act
  4. Bind the rewrite policies to a virtual server.

    • bind lb vserver rewrite_LB -policyName rewrite_domain_url_pol -priority 100 -gotoPriorityExpression END -type REQUEST
Example 12: Configure rewrite to change the host name and URL in client request on NetScaler appliance