AppExpert

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

Rewrite feature on a Citrix ADC 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 Citrix ADC 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 Citrix ADC 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 Citrix ADC appliance using SSH.

  2. Add rewrite actions.

    • add rewrite action rewrite_host_hdr_act replace "HTTP.REQ.HEADER(\"Host\")" "\"myexample.example.net.in\""

    • add rewrite action rewrite_url_act replace HTTP.REQ.URL.PATH_AND_QUERY "\"/resource/inventory/s?t=112\""

  3. Add rewrite policies for the rewrite actions.

    • add rewrite policy rewrite_host_hdr_pol "HTTP.REQ.HEADER(\"Host\").CONTAINS(\"www.example.com\") "rewrite_host_hdr_act

    • add rewrite policy rewrite_url_pol "HTTP.REQ.HEADER(\"Host\").CONTAINS(\"www.example.com\") "rewrite_url_act

  4. Bind the rewrite policies to a virtual server.

    • bind lb vserver rewrite_LB -policyName rewrite_host_hdr_pol -priority 10 -gotoPriorityExpression 20 -type REQUEST

    • bind lb vserver rewrite_LB -policyName rewrite_url_pol -priority 20 -gotoPriorityExpression END -type REQUEST

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