Forum Discussion
N__197982
Nimbostratus
Jan 13, 2016iRule to detect the client browser the request is coming from.
Folks,
I am looking for some iRule which will detect the kind of browser the request is coming from and then write some rules to handle this requests.
I want to identify if the request is coming from...
Kai_Wilke
MVP
Jan 13, 2016Hi 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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
