How to Use String Maps to Redirect Multiple Hosts on the NetScaler Appliance

How to Use String Maps to Redirect Multiple Hosts on the NetScaler Appliance

book

Article ID: CTX130161

calendar_today

Updated On:

Description

This article contains information about how to use String Maps to redirect multiple hosts on the NetScaler appliance.

Background

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.


Instructions

Complete the following steps to redirect multiple hosts on a NetScaler appliance by using String Maps:

  1. Open the Configuration utility on the appliance.

  2. Expand the AppExpert node.

  3. Select the String Maps node.

  4. Click Add, and add key value pair, as shown in the following screen shot:

    User-added image

  5. Expand the Responder node.

  6. Select the Action node.

  7. Click Add, and add a new responder action, as shown in the following screen shot:

    User-added image

  8. Select the Policies node under the Responder node.

  9. 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.

    User-added image

  10. 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.

  11. Click Insert Policy in the Responder Policy Manager Window.

  12. Select the policy.

  13. Click Apply Changes.

  14. Click Close, as shown in the following screen shot:

    User-added image

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

Issue/Introduction

This article contains information about how to use String Maps to redirect multiple hosts on the NetScaler appliance.