Forum Discussion
2 Replies
Sort By
Hi N.,
in the past I've used the snippet below to perform those kind of checks...
switch -glob -- [HTTP::header value "User-Agent"] "*iPhone*" - "*iPad*" - "*iPod*" - "*Opera M*" - "*Android*" - "*IEMobile*" - "*BlackBerry*" - "*Kindle*" { Mobile Client } "Mozilla*" - "Opera*" { Browser } default { Unknown Client }
Cheers, Kai
Hi N.,
the [switch -glob -- string1 string2 { action } ] command in the provided example is comparable with the [if { [HTTP::header value "User-Agent"] contains XYZ } then { action }] syntax. But its a little more elegant in this specific case...
The final integration into an iRules would look like that:
when HTTP_REQUEST { switch -glob -- [HTTP::header value "User-Agent"] "*iPhone*" - "*iPad*" - "*iPod*" - "*Opera M*" - "*Android*" - "*IEMobile*" - "*BlackBerry*" - "*Kindle*" { Mobile Client Place your additional code here } "Mozilla*" - "Opera*" { Browser Place your additional code here } default { Unknown Client Place your additional code here } }
Cheers, Kai