This article contains information about how to use String Maps to redirect multiple hosts on the NetScaler appliance.
Traditionally, if administrator had to redirect more than one URL or hostname, then they had to create multiple responder policies and actions. Additionally, the administrator had to take care of the bind point for each individual policy. However, using String Maps multiple redirects is possible with one policy or action.
To redirect the following hostnames hosted on a NetScaler appliance on port 80 to for example port 443 without String maps, this requires three responder policy and three responder actions and three bind points. Using pattern sets, you can achieve the same results with one responder policy and one action.
http://example.com to https://example.com/login.asp
http://example1.com to https://example1.com
http://example2.com to https://example2.com
String Mapping is a simple concept of key value pair. If the key matches, then the corresponding value is returned.
Complete the following steps to redirect multiple hosts on a NetScaler appliance by using String Maps:
Open the Configuration utility on the appliance.
Expand the AppExpert node.
Select the String Maps node.
Click Add, and add key value pair, as shown in the following screen shot:
Expand the Responder node.
Select the Action node.
Click Add, and add a new responder action, as shown in the following screen shot:
Select the Policies node under the Responder node.
Click Add to add a new policy, as shown in the following screen shot:
Note: In this case the network traffic is redirected from http to https. Therefore, ensure that you add port information in the policy to prevent loops.
Click Policy Manager.
Note: For NetScaler software release 10.1, select Responder node and click Responder Policy Manager. Refer to Configuration Utility Changes for information.
Click Insert Policy in the Responder Policy Manager Window.
Select the policy.
Click Apply Changes.
Click Close, as shown in the following screen shot:
To redirect multiple hosts on the NetScaler appliance from the command line interface, run the following commands:
add policy stringmap ResponderStringMaps bind policy stringmap ResponderStringMaps example.com https://example.com/login.asp bind policy stringmap ResponderStringMaps example1.com https://example1.com bind policy stringmap ResponderStringMaps example2.com https://example2.com add responder action Reponder_SM_redirect_act redirect "HTTP.REQ.HOSTNAME.MAP_STRING(\"ResponderStringMaps\").HTTP_URL_SAFE" add responder policy Reponder_SM_redirect "HTTP.REQ.HOSTNAME.IS_STRINGMAP_KEY(\"ResponderStringMaps\") && CLIENT.TCP.DSTPORT.EQ(80)" Reponder_SM_redirect_act bind responder global Reponder_SM_redirect 100 END -type REQ_OVERRIDE