Mobile redirects and user agent device detection on a Netscaler
This is essential for integrated caching if you do redirects on apache/nginx based on mobile device etc.
bind policy patset User_Agent_Mobile Blackberry -index 260 -charset ASCII
bind policy patset User_Agent_Mobile iPod -index 200 -charset ASCII
bind policy patset User_Agent_Mobile iPhone -index 220 -charset ASCII
bind policy patset User_Agent_Mobile iPad -index 210 -charset ASCII
bind policy patset User_Agent_Mobile Android -index 250 -charset ASCII
bind policy patset User_Agent_Desktop Linux -index 100 -charset ASCII
bind policy patset User_Agent_Desktop Macintosh -index 120 -charset ASCII
bind policy patset User_Agent_Desktop Windows -index 110 -charset ASCII
add policy expression is_mobile_ua "HTTP.REQ.HEADER(\"User-Agent\").CONTAINS_INDEX(\"User_Agent_Mobile\").BETWEEN(200,299)"
add policy expression is_desktop_ua "HTTP.REQ.HEADER(\"User-Agent\").CONTAINS_INDEX(\"User_Agent\").BETWEEN(100,199)"
then you can do policies like
add cache selector mytest HTTP.REQ.URL is_mobile_ua is_desktop_ua
which will store different versions of the content based on being a mobile device or desktop device.
Comments