Application Delivery (ADX)

URL Switching using ServerIron/ADX

by on ‎05-08-2009 04:56 AM (319 Views)


We want to load balance requests based on the prefix of the URL. Some special  prefixes should result In the selection of a specific server(s) optimized for the  content requested. To achieve this we are going to parse the traffic using a csw policy – some  prefixes are assigned to specific real servers. The csw policy is going to select the correct server for each request. Requests which do not match a specified prefix  will go to a default real server or group


We will use Layer-7 switching using csw to achieve this. Please remember the  following things:

  • Each request which does not match any of the configured prefixes is going to  a default group of real servers (the example is using the group with group-id  204).
  • The example is based on groups with a single server in each group – it is  possible to have multiple servers in each group. The ServerIron is going to load balance in between the real servers in the selected group in case there are multiple servers in the group.

The virtual server receiving the request is the one with IP address Requests with the prefix /general need to go to real server rs203  (, requests with the prefix /products to real server rs201  ( and requests with prefix /home to real server rs202  ( All other requests will go to real server rs204  (

clients -- Internet -- Router -- ServerIron -- Servers (

Sample Code/Configuration

csw-rule "general" url prefix "/GENERAL" case-insensitive
csw-rule "hrule2" url prefix "/HOME" case-insensitive
csw-rule "products" url prefix "/PRODUCTS" case-insensitive
csw-policy "Policy1"
match "products" forward 201
match "hrule2" forward 202
match "general" forward 203
default forward 204
server real rs201
port http
port http url "HEAD /"
port http group-id  201 201
server real rs202
port http
port http url "HEAD /"
port http group-id  202 202
server real rs203
port http
port http url "HEAD /"
port http group-id  203 203
server real rs204
port http
port http url "HEAD /"
port http group-id  204 204
server virtual vs100
port http
port http csw-policy "MyRule"
port http csw
bind http rs201 http rs202 http rs203 http rs204 http

Tips / Caveats


1. Use some clients to send requests with a known URL in – check the statistics  related to the defined cse rule. Each rule does have a counter to show the  amount of hits related to this rule:

ServerIron# show csw-policy MyRule

Policy Name           : MyRule

Policy Type             : Content Switching
Policy index            : 1
Reference Count      : 1
total received packe : 0
created session       : 0             total scanned packet : 0
no session drop       : 0             no session frag drop  : 0
send mirror ip packe : 0            send mirror packet     : 0
send redirect packet : 0            case-insensitive         : TRUE

Action code description:
fwd: forward   rst: reset-client   per: persist
rdr: redirect   err: reply-error   got: goto
rwt: rewrite   mir: mirror      log: log
con: count   drp: drop   rec: vir-reset
red: cont-red   mip: mirror-ip   unk: unknown

Flag description:
A: insert-cookie   B: delete-cookie   C: destroy-cookie
D: req-ins-hdr      E: req-ins-client-ip   F: resp-ins-hdr
G: delete-content   H: insert-content   I: modify-content
L: log

Rule Name   |Act|Data1     |Data2     |Data3     |Flags     |Hit Cnt
products    |     |      |               |     |12         |
products    |fwd|201       |          |N/A       |_________ |12
home        |     |      |               |     |26         |
home        |fwd|202       |          |N/A       |_________ |26
general     |     |      |               |     |5          |
general     |fwd|203       |          |N/A       |_________ |5
default     |     |      |               |     |9          |
default     |fwd|204       |          |N/A       |_________ |

Verify that correctness of the stats based on your requests.

Further Reading

This describes recommended  additional sections to review