How do I Content Switch based on User-Agent

HowdoIconfigureNetScalerforContent
SwitchingbasedonUser-Agent?
UseCase:
CurrentlythevarietyofdevicesaccessingthecontentontheInternethaveproliferatedand
thepurposesoftheiraccessmightalsobeverydifferent.Forinstance,someclientsareused
onlyforAutomationandrequestsareusuallyREST-API’sandotherclientsmightcomefrom
mobiledeviceswherethescreenresolutionisofsmallersizeandthebandwidthavailableis
low.
Belowisbroadcategoryofclients
1. AutomationRESTAPIClients–Noneedforimagerelatedcontent
2. ClientsfromMobiledevices–Smallerscreensizeandneedforlesserbandwidth
usage
3. iPhone/iPad–ContentmightbedeliveredusingApplespecificfeatures
4. Bot–Automatedagents–crawler–Forexamplewillhave“Googlebot”intheiruseragent.
Inthesescenariositwouldbegreatiftherequestslandontheserverswhichwillmeettheir
uniqueneeds.
OneofthewaystodifferentiateclientsisbasedontheUser-Agentandthefollowingguide
explainsthestepstoconfiguretheNetScalertoidentifythebehavior/capabilitiesofthat
particularclientusingtheuser-agentandtoredirecttheclienttotheserveristunedfor
meetingtheneedsofthatparticularclient.
Instructions:
Step1:
ForallthevserverandthedevicecombinationsidentifytheuniqueUser-agenttext.Inall
requeststheUser-Agentheaderwillbethereandfromthattheuniquetextcanbederived
Step2:
ConfiguretheContentSwitchpolicy
GUI:
TrafficManagement->ContentSwitching>Policies->Add
InthebelowsnapshotweseetheExpressionandintheBelowexpressionthetextwithin
CONTAINSneedstobemodifiedbasedoncustomer’srequirement.
CLI:
addcsactionuseragentmozilla-targetLBVserver<vservername>
addcspolicyuseragent-rule"HTTP.REQ.HEADER(\"UserAgent\").CONTAINS(\"Mozilla\")\n"
-actionuseragentmozilla
Step3:
BindittotheContentSwitchvserverandalsoselecttheappropriatethevserverwhichwill
handlethetraffic
GUI:
TrafficManagement->ContentSwitching->VirtualServers->Edit->ContentSwitchPolicy
Binding
CLI:
bindcsvservervserveruser-agent-policyNameuseragent-priority100
Step4:
Repeatsteps2and3forallthevserveranduser-agentcombinations