Citrix
Include legacy content
[x]

Site Alert(s):

  • We are currently experiencing issues with the display of certain articles. We are working to resolve this as soon as possible. We apologize for the inconvenience.

How to use the Rewrite Feature of a NetScaler Appliance to Change the Destination Path of a GET Request Based on the User-Agent

  • CTX124390
  • Created On  Apr 06, 2010
  • Updated On  Mar 10, 2012
  • Article
  • Topic : Other

Summary

This document contains information about using the Rewrite feature of the NetScaler appliance to change the destination path of a GET request based on the User-Agent.

Requirements

Before you start configuring the Rewrite feature, it is advisable to record an HTTP Header trace to confirm the User-Agents for the client requests. The following are the sample User-Agents that connected the Web site by using the Firefox version 3.5.8 and Microsoft Internet Explorer version 7.0:

  • Firefox User-Agent:
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 GTB6 (.NET CLR 3.5.30729)
  • Internet Explorer User-Agent:
    User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 6.4.1321.1732; Windows XP 5.1; MSIE 7.0.5730.11)

You can configure the rewrite policy to match any expression in the User-Agent header value field.

Using the Rewrite Feature of the NetScaler Appliance to Change the Destination Path of a GET Request Based on the User-Agent

To use the Rewrite feature of the NetScaler appliance to change the destination path of a GET request based on the User-Agent, complete the following procedure from the command line interface of the appliance:

  1. Run the following command to create a Rewrite action to insert Firefox after the HTTP request URL:
    add rewrite action ua_rewrite_Firefox_act insert_after HTTP.REQ.URL "\"Firefox\""
  1. Run the following command to create a Rewrite action to insert IE after the HTTP request URL:
    add rewrite action ua_rewrite_IE_act insert_after HTTP.REQ.URL "\"IE\""
  1. Run the following command to create a policy to match User-Agent header for Firefox and ignore case in the request URL:
    add rewrite policy ua_rewrite_Firefox_pol "http.REQ.HEADER(\"User-Agent\").SET_TEXT_MODE(IGNORECASE).REGEX_MATCH(re/Firefox/) " ua_rewrite_Firefox_act
  1. Run the following command to create a policy to match User-Agent header for Internet Explorer and ignore case in the request URL:
    add rewrite policy ua_rewrite_IE_pol "http.REQ.HEADER(\"User-Agent\").SET_TEXT_MODE(IGNORECASE).REGEX_MATCH(re/MSIE/) " ua_rewrite_IE_act
  1. Run the following command to bind the policies you created to the required Load Balancing virtual server:
    bind lb vserver ua_redirect_LB -policyName ua_rewrite_Firefox_pol -priority 100 -gotoPriorityExpression END -type REQUEST
    bind lb vserver ua_redirect_LB -policyName ua_rewrite_IE_pol -priority 110 -gotoPriorityExpression END -type REQUEST

More Information

The following screenshot displays the traces of the packets recorded to show a GET request from a Firefox client to the / directory being directed to the /Firefox directory for the NetScaler appliance request to the backend server. Additionally, a GET request from an Internet Explorer client to the / directory is directed to the /IE directory for the NetScaler appliance request to the backend server.


Share your comments or find out more about this topic

Citrix Forums

Languages

N/A

Was this helpful?

Thank you for your feedback!


| Privacy & Terms