Jump to content
Welcome to our new Citrix community!
  • Intelligent Traffic Routing with NetScaler


    Guest
    • Validation Status: Work In Progress
      Summary: NetScaler content switching feature enables the appliance to distribute client requests across multiple servers based on specific content that you want to present to those users.
      Has Video?: No

    Need for Intelligent Routing

    In today’s complex websites, you might want to present different content to different users. You might want to present content relevant to a specific geographical area to users from that area. You might want to present content in different languages to the speakers of those languages. You might want to present content tailored to specific devices, such as smartphones, to them who use the devices. The NetScaler content switching feature enables the appliance to distribute client requests across multiple servers based on specific content that you want to present to those users.

     

    NetScaler Content Switching

    NetScaler Content Switching configuration entails enabling the content switching feature, setting up load balancing for the server or servers that host each version of the content that is being switched, creating a content switching virtual server, creating policies to choose which requests are directed to which load balancing virtual server, and binding the policies to the content switching virtual server. You can then customize the setup to meet your needs by setting precedence for your policies, protecting your setup by configuring a backup virtual server, and improving the performance of your setup by redirecting requests to a cache. You can learn more about it here.

     

    Content Switching Example using Terraform

    The following example shows the steps to configure two address-based virtual servers to perform load balancing on the HTTP services. One virtual server, Vserver-LB-HTML, load balances the dynamic content (cgi, asp), and the other, Vserver-LB-Image, load balances the static content (GIF, jpeg). The load-balancing method used is the default, LEASTCONNECTION. A content switching SSL virtual server, Vserver-CS-SSL, is then configured to perform SSL acceleration and switching of HTTPS requests based on configured content switching policies. Below is an terraform resource file for above use-case :

     

     

    resource "citrixadc_lbvserver" "lb_1" {  name        = var.lbvserver1_name  ipv46       = var.lbvserver1_ip  port        = var.lbvserver1_port  servicetype = var.lbvserver1_servicetype  state       = "ENABLED"}resource "citrixadc_lbvserver" "lb_2" {  name        = var.lbvserver2_name  ipv46       = var.lbvserver2_ip  port        = var.lbvserver2_port  servicetype = var.lbvserver2_servicetype  state       = "ENABLED"}resource "citrixadc_service" "tf_service1" {  name        = var.service1_name  servicetype = var.service1_servicetype  ipaddress   = var.service1_ip  ip          = var.service1_ip  port        = var.service1_port  state       = "ENABLED"}resource "citrixadc_service" "tf_service2" {  name        = var.service2_name  servicetype = var.service2_servicetype  ipaddress   = var.service2_ip  ip          = var.service2_ip  port        = var.service2_port  state       = "ENABLED"}resource "citrixadc_service" "tf_service3" {  name        = var.service3_name  servicetype = var.service3_servicetype  ipaddress   = var.service3_ip  ip          = var.service3_ip  port        = var.service3_port  state       = "ENABLED"}resource "citrixadc_service" "tf_service4" {  name        = var.service4_name  servicetype = var.service4_servicetype  ipaddress   = var.service4_ip  ip          = var.service4_ip  port        = var.service4_port  state       = "ENABLED"}resource "citrixadc_lbvserver_service_binding" "tf_binding1" {  name        = citrixadc_lbvserver.lb_1.name  servicename = citrixadc_service.tf_service1.name}resource "citrixadc_lbvserver_service_binding" "tf_binding2" {  name        = citrixadc_lbvserver.lb_1.name  servicename = citrixadc_service.tf_service2.name}resource "citrixadc_lbvserver_service_binding" "tf_binding3" {  name        = citrixadc_lbvserver.lb_2.name  servicename = citrixadc_service.tf_service3.name}resource "citrixadc_lbvserver_service_binding" "tf_binding4" {  name        = citrixadc_lbvserver.lb_2.name  servicename = citrixadc_service.tf_service4.name}resource "citrixadc_csvserver" "tf_csvserver" {  name        = var.csvserver_name  ipv46       = var.csvserver_ipv46  port        = var.csvserver_port  servicetype = var.csvserver_servicetype  state       = "ENABLED"  stateupdate = "ENABLED"}resource "citrixadc_cspolicy" "tf_cspolicy1" {  policyname = var.cspolicy1_name  url        = var.cspolicy1_url}resource "citrixadc_cspolicy" "tf_cspolicy2" {  policyname = var.cspolicy2_name  url        = var.cspolicy2_url}resource "citrixadc_cspolicy" "tf_cspolicy3" {  policyname = var.cspolicy3_name  url        = var.cspolicy3_url}resource "citrixadc_cspolicy" "tf_cspolicy4" {  policyname = var.cspolicy4_name  url        = var.cspolicy4_url}resource "citrixadc_csvserver_cspolicy_binding" "tf_bind1" {  name            = citrixadc_csvserver.tf_csvserver.name  policyname      = citrixadc_cspolicy.tf_cspolicy1.policyname  targetlbvserver = citrixadc_lbvserver.lb_1.name}resource "citrixadc_csvserver_cspolicy_binding" "tf_bind2" {  name            = citrixadc_csvserver.tf_csvserver.name  policyname      = citrixadc_cspolicy.tf_cspolicy2.policyname  targetlbvserver = citrixadc_lbvserver.lb_1.name}resource "citrixadc_csvserver_cspolicy_binding" "tf_bind3" {  name            = citrixadc_csvserver.tf_csvserver.name  policyname      = citrixadc_cspolicy.tf_cspolicy3.policyname  targetlbvserver = citrixadc_lbvserver.lb_2.name}resource "citrixadc_csvserver_cspolicy_binding" "tf_bind4" {  name            = citrixadc_csvserver.tf_csvserver.name  policyname      = citrixadc_cspolicy.tf_cspolicy4.policyname  targetlbvserver = citrixadc_lbvserver.lb_2.name}resource "citrixadc_sslcertkey" "tf_sslcertkey" {  certkey = var.sslcertkey_name  cert    = var.sslcertkey_cert  key     = var.sslcertkey_key}resource "citrixadc_sslvserver_sslcertkey_binding" "tf_binding" {  vservername = citrixadc_csvserver.tf_csvserver.name  certkeyname = citrixadc_sslcertkey.tf_sslcertkey.certkey}

    In below, examples.tfvars file we have the input values and the definition of policies based on which routing decision will be taken :

    # Lb_Vserver1lbvserver1_name        = "Vserver-LB-HTML"lbvserver1_ip          = "10.1.1.2"lbvserver1_port        = 80lbvserver1_servicetype = "HTTP"# Lb_Vserver2lbvserver2_name        = "Vserver-LB-Image"lbvserver2_ip          = "10.1.1.3"lbvserver2_port        = 80lbvserver2_servicetype = "HTTP"# Service 1service1_name        = "s1"service1_ip          = "10.1.1.4"service1_port        = 80service1_servicetype = "HTTP"# Service 2service2_name        = "s2"service2_ip          = "10.1.1.5"service2_port        = 80service2_servicetype = "HTTP"# Service 3service3_name        = "s3"service3_ip          = "10.1.1.6"service3_port        = 80service3_servicetype = "HTTP"# Service 4service4_name        = "s4"service4_ip          = "10.1.1.7"service4_port        = 80service4_servicetype = "HTTP"# CS Vservercsvserver_name        = "Vserver-CS-SSL"csvserver_ipv46       = "10.1.1.1"csvserver_port        = 443csvserver_servicetype = "SSL"# CS Policy 1cspolicy1_name = "pol1"cspolicy1_url  = "/*.cgi"# CS Policy 2cspolicy2_name = "pol2"cspolicy2_url  = "/*.asp"# CS Policy 3cspolicy3_name = "pol3"cspolicy3_url  = "/*.gif"# CS Policy 4cspolicy4_name = "pol4"cspolicy4_url  = "/*.jpeg"# SSL CertKeysslcertkey_name = "mykey"sslcertkey_cert = "/nsconfig/ssl/ns-root.cert"sslcertkey_key  = "/nsconfig/ssl/ns-root.key"

    On running the above terraform scripts on your target NetScaler you can set up intelligent routing for the above use case. You can download the above scripts and learn about terraform execution here.

     

     

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...