[x]

Site Alert(s):

  • Server maintenance Saturday Nov 22, 2008, 12:00 PM - 3:00 PM. The Knowledge Center will be unavailable during this time.
Rate this Article:
You must be signed in to rate again
Article Feedback Print View
Alternate Languages: N/A

How to Load Balance Web Interface with a NetScaler

Document ID: CTX111080   /   Created On: Jan 31, 2007   /   Updated On: Apr 6, 2007
Average Rating: 1

Summary

This article describes how to load balance Web Interface with a NetScaler.

Background

When a NetScaler is used to load balance Web Interface, it uses either the Management IP (MIP) address or the Subnet IP (SNIP) address as the source IP address when communicating with Web Interface. Web Interface then sees all users, local or remote, as coming from the same IP. This limits Web Interface’s ability to determine where the client is coming from and which IP address (either local or alternate) to issue when launching an application.

To force Web Interface to see the real client IP address, you must make a modification on both the NetScaler and Web Interface systems. It may be necessary to use a network trace or another network monitoring application to determine the actual source IP address used by the NetScaler when communicating to the back-end servers.

Procedure

On the NetScaler:

The NetScaler allows for the insertion of the real client IP address into an HTTP head when passing traffic to the back-end servers. This is called Client IP insertion. This is typically set on the individual services configured for Web Interface.

  1. To set Client IP insertion, open the service for the Web Interface servers and click the Advanced tab.

  1. Under Settings, select the Client IP check box.
  2. In the Header field, type the name of the header you want to use.
    Note
    : For the Header field it is possible to use any header name, but it must match the generated variable name. Typically, the variable that is generated in Internet Information Services (IIS) begins with HTTP_ with the variable name afterwards in uppercase (for example, HTTP_CLIENTIP).

In Web Interface:

By default, Web Interface uses an IIS variable called REMOTE_ADDR to make the decision to use either the local IP address of the Presentation Server or the alternate address defined in the Presentation Server. This behavior can be configured to use a different variable using the following procedure on the Web Interface server.

Two files MUST be changed for this to work. You must also know which IP address is being used as the source IP address from the NetScaler when communicating to Web Interface. It is required for the modifications listed below.
Note
: Make a backup copy of the files listed below before making any changes.

Modifying the site/serverscripts/include.cs file:

  1. On the Web Interface server, modify the include.cs file located in the following directory:

    <presentation_server_installation>/site/serverscripts/include.cs


  2. In the include.cs file, locate the following lines:

    /**
    * Returns the IP address of the client.
    */
    public string getClientAddress() {
        return Request.ServerVariables["REMOTE_ADDR"];
    }

  3. Replace ALL of the lines listed above with the following text:

    /**
    * Returns the IP address of the client.
    */
    public string getClientAddress() {
        if (!(Request.ServerVariables["HTTP_CLIENTIP"] == null) && (Request.ServerVariables["REMOTE_ADDR"] == "A.B.C.D"))
        {
            return Request.ServerVariables["HTTP_X_CLIENTIP"];
        } else {
            return Request.ServerVariables["REMOTE_ADDR"];
        }
    }

    Important
    : Replace A.B.C.D with the NetScaler IP address used to communicate with Web Interface.
  4. Save the file.

Modifying the site/serverscripts/session.cs file:

  1. On the Web Interface server, modify the session.cs file located in following directory:

    <presentation_server_installation>/site/serverscripts/session.cs


  2. In the session.cs file, locate the following line:

    deviceInfo.setDetectedAddress( Request.UserHostAddress );

  3. Replace the line listed above with the following text:

    deviceInfo.setDetectedAddress( getClientAddress() );

  4. Save the file.
  5. Issue the iisreset command on the Web Interface system to allow the changes to take place. You must then configure Web Interface accordingly.

More Information

Refer to the NetScaler Installation and Configuration Guide or the Web Interface Administrator’s Guide for further assistance.

Note: Citrix NetScaler product documentation can be accessed from the Citrix Knowledge Center by NetScaler customers who are logged on and have valid NetScaler maintenance agreements


Search
Knowledge Center
XenApp
XenApp Plugins (Clients)
XenServer
XenDesktop
NetScaler Application Delivery
Access Gateway
EdgeSight
Provisioning Server
WANScaler
Password Manager
Does it work with Citrix? Verify it - introducing the new Citrix Ready Community Verified