Redirecting a URL based on a clients subnet can be achieved by using a responder policy. In this post I will go through the basic settings to make this happen, but of course because its netscaler there a many different options you can add to get the results you want.

But in my example all I want to do is redirect users who hit the http://netscaler.scriv.local url from the 192.168.1.0 subnet to another url http://netscalerredirect.scriv.local .

 

To start with you will need to enable the responder node (if its not enabled already) by right clicking on the responder node and selecting enable responder feature.

Configure Actions

Now we are getting into the fun part. Expand the Responder node and click the Actions submenu then click the ADD button.

This will tell the responder what to do when the policy finds a match so give your action a name and from the TYPE menu select “respond with”.

Within the target space type the following:

“HTTP/1.1 302 Object Moved\r\n” + “Location: http://netscalerredirec.scriv.local” + “\r\n”

 

This tells the browser that the url requested has moved and provides the browser with a new url to resolve to.Click OK to complete the Actions configuration.

 

Configure Policy

Next click on the policies sub menu and click ADD and give your policy a name, then under the Action drop down menu select the action you have just created in the previous step. Now in the Expression box type the following:

HTTP.REQ.HEADER(“Host”).CONTAINS(“netscaler.scriv.local”) && CLIENT.IP.SRC.IN_SUBNET(192.168.1.0/24)

This policy states that if the url netscaler.scriv.local is called and the clients subnet is in 192.168.1.0 then the selected action will be applied.

Now all that remains is to bind this policy to a VIP so open your vserver (in this instance a simple load balancing vserver) and click on the policies tab and then the responder button. Then click insert policy and select the policy you have just created.

Author: Dale Scriven

 

Tagged with:
 

Leave a Reply

Set your Twitter account name in your settings to use the TwitterBar Section.
%d bloggers like this: