To configure the Content Switching feature on the NetScaler appliance to access multiple Web sites hosted on a Web server, complete the following procedures.
NetScaler GUI
To configure the Content Switching feature on the NetScaler appliance, complete the following procedure:
- To add Load Balancing Servers with the IP Address/Domain Name field set to the hostname of the web servers, complete the following sub-procedure:
- Expand the Traffic Management > Load Balancing node.
- Select the Servers node.
- Click Add.
- If IP Address is selected, enter the IP address of the web server. Or, change the selection to Domain Name and enter the FQDN of the web server. This assumes that the NetScaler is able to resolve the DNS name.
- Click OK.
- To create multiple Load Balancing Service Groups configured to point to the new Servers, complete the following sub-procedure:
- Expand the Traffic Management > Load Balancing node.
- Select the Monitors node.
- Click Add.
- Give the monitor a name. Keep in mind that you’ll have a different monitor for each website and each protocol (e.g. HTTP vs SSL)
- Configure the monitor as needed for your website. Usually you want a monitor that requests a healthcheck page and looks for a successful response.
- Click Create.
- Create more Monitors for each website and protocol.
- To create multiple Load Balancing Service Groups configured to point to the new Servers, complete the following sub-procedure:
- Expand the Traffic Management > Load Balancing node.
- Select the Service Groups node.
- Click Add.
- Give the Service Group a name. Keep in mind that you’ll create a different Service Group for each website, and a different Service Group for each protocol (e.g. HTTP vs SSL)
- Add the members by selecting the Load Balancing Servers created in step 1 and entering their port number (e.g. 80 or 443).
- Bind a monitor to the Service Group. Each Service Group usually has a website-specific monitor.
- Click Create.
- Create more Service Groups for each website and protocol.
- To create Load Balancing Virtual Servers (VServers) for each website, complete the following sub- procedure:
- Expand the Traffic Management > Load Balancing node.
- Select the Virtual Servers node.
- Click Add.
- Give the Virtual Server a name. Keep in mind that you’ll have a different Virtual Server for each website and each protocol (e.g. HTTP vs SSL).
- Change the IP Address Type to Non-addressable.
- Click Create.
- Create more Load Balancing Virtual Servers for each website and protocol.
- To create Content Switching policies for each URL, complete the following sub-procedure:
- Expand the Traffic Management > Content Switching node.
- Select the Policies node.
- Click Add.
- Give the Content Switching Policy a name. Keep in mind that you’ll need a separate Content Switching Policy for each website and protocol (e.g. HTTP vs SSL)
- Enter the required expression. An example hostname-based expression is: HTTP.REQ.HOSTNAME.EQ(“portal.company.com”). An example path-based expression is HTTP.REQ.URL.PATH.STARTSWITH(“/portal/”).
- There is no need to select an Action at this time.
- Click Create.
- Create more Content Switching Policies for each website and protocol.
- To create a Content Switching VServer, such that one Virtual IP address can access both Web sites, complete the following sub-procedure:
- Expand the Traffic Management > Content Switching node.
- Select the Virtual Servers node.
- Click Add.
- Give the Content Switching Virtual Server a name. Keep in mind that you will have a different Content Switching Virtual Server for each protocol (e.g. HTTP vs SSL). However, each protocol-specific Content Switching Virtual Server will handle all of the websites.
- Click where it says No Content Switching Policy Bound.
- Click where it says Client to Select and select one of your Content Switching Virtual Servers.
- In the Target Load Balancing Virtual Server field, select the Load Balancing Virtual Server that matches the Content Switching Policy. Click Bind.
- Repeat the Content Switching Policy bindings for each website.
- If this Content Switching Virtual Server is SSL, then bind a Server Certificate, configure ciphers, disable SSL v3, etc.
- Click Create to finish creating the Content Switching Virtual Server.
- Create another Content Switching Virtual Server for other protocols (e.g. HTTP vs SSL).
NetScaler CLI
To configure the Content Switching VServer, similar to the one configured in the preceding procedure, from the command line interface of the appliance, run the following commands:
add server webserver1 webserver1.example.comadd server webserver2 webserver2.example.comadd serviceGroup portal_svcgrp Example HTTP 80bind serviceGroup portal_svcgrp webserver1bind serviceGroup portal_svcgrp webserver2add serviceGroup www_svcgrp Example HTTP 80bind serviceGroup www_svcgrp webserver1bind serviceGroup wwww_svcgrp webserver1add lb vserver portal_vserver-http HTTP 0.0.0.0 0 -persistenceType SOURCEIP -cltTimeout 180bind lb vserver portal_vserver-http portal_svcgrpadd lb vserver www_vserver-http HTTP 0.0.0.0 0 -persistenceType SOURCEIP -cltTimeout 180bind lb vserver www_vserver-http www_svcgrpadd cs policy csw_pol_portal-http -rule "HTTP.REQ.HOSTNAME.EQ("portal.example.com")"add cs policy csw_pol_www-http -rule "HTTP.REQ.HOSTNAME.EQ("www.example.com")"add cs vserver csw_vserv-http HTTP 192.168.168.170 80 -cltTimeout 180bind cs vserver csw_vserv-http portal_vserver-http -policyName csw_pol_portal-http -priority 100bind cs vserver csw_vserv-http www_vserver-http -policyName csw_pol_www-http -priority 110