Configuring Redirection Mode

You can configure a Load Balancing HTTP or HTTPS VServer with a redirect URL on the Citrix NetScaler Load Balancing VIP. This URL can be sent as a response to the client HTTP or HTTPS request if the VServer is not available. The common usage of this option is to direct the client to a customized Site Down Web page or to an external backup Web site. Another common use it to redirect HTTP requests to HTTPS requests, forcing clients to use HTTPS.

The redirection mode determines the destination address to forward the incoming traffic. The NetScaler provides the following redirection modes:

  • IP-Based forwarding (default)
  • MAC-Based forwarding
    Note: By default, the NetScaler uses IP-Based forwarding. You can set MAC-Based forwarding in case of direct server return (DSR) topology, link load balancing, and firewall load balancing.

To configure Redirection for a Load Balancing Vserver or VIP:

  1. In the navigation pane, expand Load Balancing, and then click Virtual Servers.
  2. In the details pane, select the virtual server for which you want to configure the redirection mode (for example, Vserver-LB-1), and then click Open.
  3. On the Advanced tab, Enter the Redirect URL. ex: http://<redirect.domain.tld>
  4. Click OK.

To force HTTP to HTTPS traffic for a Load Balancing Vserver or VIP:

  1. In the navigation pane, expand Load Balancing, and then click Virtual Servers.
  2. In the details pane, select the virtual server for which you want to configure the redirection mode (for example, Vserver-LB-1), and then click Open.
  3. On the Advanced tab, Enter the Redirect URL. ex: https://<domain.tld>
  4. Mark the state of the HTTP Vserver to Down. (By forcing the HTTP Vserver down, it will automatically send all requests to the HTTPS URL you configure here).
  5. Click OK.

When the state of the VServer is DOWN or DISABLED, then the NetScaler appliance responds to HTTP(S) requests with the HTTP/1.x 302 – Object Moved response code and the configured redirect URL specified in the Location header of the HTTP response. The exact URL specified in the response depends on the following configuration options:

Note: The domain names in the request and response can differ. In this document, the two domains are referred to as sample1.example.com and sample2.example.com to explain the concept. If the configured redirect URL contains a complete path, then the redirect response specifies the complete configured URL, irrespective of the URI in the request. For example, the following are such URLs:

Configured Redirect URL URL in HTTP Request Contents of Location: header in HTTP Response
http://www.sample1.example.com http://www.sample2.example.com/en/index.html http://www.sample1.example.com/en/index.html
http://www.sample1.example.com/en/error.html http://www.sample2.example.com/en/index.html http://www.sample1.example.com/en/error.html

Note: It is worth noting that when configuring a redirect URL, the http://example.com URL is not the same as the http://example.com/ URL because the latter contains the complete path to the Web root, /.

Configuring the Redirect URL Option using CLI commands:

  • Run the following command from the command line interface of the appliance:*
    set vserver &lt;VServer_Name&gt; -redirectURL &lt;URL&gt;
  • To verify that the redirect URL option is working as expected, disable the VServer. Run the following command to disable the VServer:
    disable vserver &lt;VServer_Name&gt;
  • Access the Web site URL from a Web browser to verify that the request is being redirected as expected. You might need to clear the Web browser cache and make a new connection before accessing the Web site.
  • From the command line interface of the NetScaler appliance, run the following command to re-enable the VServer (or leave it disabled to permanently redirect HTTP to HTTPS:
    enable vserver &lt;VServer_Name&gt;

Note:
If you have configured extensive redirect infrastructures by using artificially downed Load Balancing VServers with redirect URLs, then Citrix recommends that you use the Responder feature. An example of using responder to send the 404 response code is available in the Knowledge Center article How to Configure the NetScaler Appliance to Respond with the 404 Not Found Response Code Depending on Certain Parameters in the Client Request. You can customize the procedure in this article to send the 302 response code, or any other response you might want to configure.

The Redirect feature is not applicable for the non-HTTP or non-HTTPS protocols.




Get the most powerful Redirector here.




It’s powerful!