For more details, please see ourCookie Policy.

Application Delivery (ADX)

Header based content switching / L7 switching (CSW) with ServerIron

by on ‎05-08-2009 06:38 AM (930 Views)



Different browser/devices do require a special handling from time to time to ensure the content fits the screen or matches the browser type. Mobile devices have smaller screens and it is good practice to use a different page layout to make a web site useful for these users.




We are going to create a rule that will forward anything from a Windows CE or Windows Mobile device to a different real server(s) that is providing some variance in application service (like different page layout or different object sizes) for those mobile users . Other users will default to accessing real servers(s) for other clients (e.g desktop based users etc.)


In a packet capture from a Windows Mobile 6 smart phone we can see the User-Agent string.

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12) HTC-SMT5800\r\n


We will match on IEMobile for the Windows Mobile Devices and Windows CE for the legacy devices and forward to a server group-id 2. Anything that does not match will go to the default group-id 1.


Of course this could be expanded to other devices such as BlackBerry or iPhone. A BlackBerry User-Agent string looks like this:

User-Agent: BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/109\r\n

User-Agent: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)


So you can simply create another rule to match "BlackBerry" or "iPhone" and forward to group-id 2.



Topology Diagram




Sample Code / Configuration


csw-rule "r1" header "USER-AGENT" search "IEMOBILE" case-insensitive

csw-rule "r2" header "USER-AGENT" search "WINDOWS CE" case-insensitive


csw-policy "p1" case-insensitive

match "r1" forward 2

match "r2" forward 2

default forward 1


server real www1

port http

port http group-id  1 1


server real mobile1

port http

port http group-id  2 2


server virtual vip1

port http

port http csw-policy "p1"

port http csw

port http keep-alive

bind http www1 http mobile1 http

Tips / Caveats


To verify that rules are being hit, check the output of show csw-p "policy name". See below


SI400-21/2#show csw-p p1


Policy Name         :p1
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 
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
r1          |     |      |               |     |1          |
r1          |fwd|2         |          |N/A       |_________ |1
r2          |     |      |               |     |0          |
r2          |fwd|2         |          |N/A       |_________ |0
default     |     |      |               |     |0          |
default     |fwd|1         |          |N/A       |_________ |0


Further Reading